Skip to content

Commit 8826f72

Browse files
authored
Merge pull request #2 from pjoriginal/electron-nightly
Updated files to accept new single array args
2 parents e661af8 + 0ee7b96 commit 8826f72

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/electron/index.js

+21-21
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ module.exports = {
8080
* @returns {Promise<Array>} - An array of Entries in that directory
8181
*
8282
*/
83-
readEntries: function ([[fullPath]]) {
83+
readEntries: function ([fullPath]) {
8484
return new Promise((resolve, reject) => {
8585
fs.readdir(fullPath, { withFileTypes: true }, (err, files) => {
8686
if (err) {
@@ -131,7 +131,7 @@ module.exports = {
131131
* fullPath: the full path of the file including the extension.
132132
* @returns {Promise<Object>} - An Object containing the file metadata.
133133
*/
134-
getFileMetadata: function ([[fullPath]]) {
134+
getFileMetadata: function ([fullPath]) {
135135
return new Promise((resolve, reject) => {
136136
fs.stat(fullPath, (err, stats) => {
137137
if (err) {
@@ -158,7 +158,7 @@ module.exports = {
158158
* fullPath: the full path of the file or directory.
159159
* @returns {Promise<Object>} - An Object containing the metadata.
160160
*/
161-
getMetadata: function ([[url]]) {
161+
getMetadata: function ([url]) {
162162
return new Promise((resolve, reject) => {
163163
fs.stat(url, (err, stats) => {
164164
if (err) {
@@ -182,7 +182,7 @@ module.exports = {
182182
* metadataObject: the object containing metadataValues (currently only supports modificationTime)
183183
* @returns {Promise<Object>} - An Object containing the file metadata.
184184
*/
185-
setMetadata: function ([[fullPath, metadataObject]]) {
185+
setMetadata: function ([fullPath, metadataObject]) {
186186
return new Promise((resolve, reject) => {
187187
const modificationTime = metadataObject.modificationTime;
188188
const utimesError = function (err) {
@@ -208,7 +208,7 @@ module.exports = {
208208
*
209209
* @returns {Promise<String>} The string value within the file.
210210
*/
211-
readAsText: function ([[fileName, enc, startPos, endPos]]) {
211+
readAsText: function ([fileName, enc, startPos, endPos]) {
212212
return readAs('text', fileName, enc, startPos, endPos);
213213
},
214214

@@ -222,7 +222,7 @@ module.exports = {
222222
*
223223
* @returns {Promise<String>} the file as a dataUrl.
224224
*/
225-
readAsDataURL: function ([[fileName, startPos, endPos]]) {
225+
readAsDataURL: function ([fileName, startPos, endPos]) {
226226
return readAs('dataURL', fileName, null, startPos, endPos);
227227
},
228228

@@ -236,7 +236,7 @@ module.exports = {
236236
*
237237
* @returns {Promise<String>} The file as a binary string.
238238
*/
239-
readAsBinaryString: function ([[fileName, startPos, endPos]]) {
239+
readAsBinaryString: function ([fileName, startPos, endPos]) {
240240
return readAs('binaryString', fileName, null, startPos, endPos);
241241
},
242242

@@ -250,7 +250,7 @@ module.exports = {
250250
*
251251
* @returns {Promise<Array>} The file as an arrayBuffer.
252252
*/
253-
readAsArrayBuffer: function ([[fileName, startPos, endPos]]) {
253+
readAsArrayBuffer: function ([fileName, startPos, endPos]) {
254254
return readAs('arrayBuffer', fileName, null, startPos, endPos);
255255
},
256256

@@ -262,7 +262,7 @@ module.exports = {
262262
*
263263
* @returns {Promise<void>} resolves when file or directory is deleted.
264264
*/
265-
remove: function ([[fullPath]]) {
265+
remove: function ([fullPath]) {
266266
return new Promise((resolve, reject) => {
267267
fs.stat(fullPath, (err, stats) => {
268268
if (err) {
@@ -290,7 +290,7 @@ module.exports = {
290290
*
291291
* @returns {Promise<void>} resolves when file or directory is deleted.
292292
*/
293-
removeRecursively: function ([[fullPath]]) {
293+
removeRecursively: function ([fullPath]) {
294294
return new Promise((resolve, reject) => {
295295
fs.stat(fullPath, (err, stats) => {
296296
if (err) {
@@ -329,7 +329,7 @@ module.exports = {
329329
*
330330
* @returns {Promise<Object>} The parent directory object that is converted to DirectoryEntry by cordova.
331331
*/
332-
getParent: function ([[url]]) {
332+
getParent: function ([url]) {
333333
const parentPath = path.dirname(url);
334334
const parentName = path.basename(parentPath);
335335
const fullPath = path.dirname(parentPath) + path.sep;
@@ -347,7 +347,7 @@ module.exports = {
347347
*
348348
* @returns {Promise<Object>} The copied file.
349349
*/
350-
copyTo: function ([[srcPath, dstDir, dstName]]) {
350+
copyTo: function ([srcPath, dstDir, dstName]) {
351351
return new Promise((resolve, reject) => {
352352
if (dstName.indexOf('/') !== -1 || path.resolve(srcPath) === path.resolve(dstDir + dstName)) {
353353
reject(new Error(FileError.INVALID_MODIFICATION_ERR));
@@ -360,7 +360,7 @@ module.exports = {
360360
fs.stat(srcPath)
361361
.then((stats) => {
362362
fs.copy(srcPath, dstDir + dstName, { recursive: stats.isDirectory() })
363-
.then(async () => resolve(await stats.isDirectory() ? getDirectory([[dstDir, dstName]]) : getFile([[dstDir, dstName]])))
363+
.then(async () => resolve(await stats.isDirectory() ? getDirectory([dstDir, dstName]) : getFile([dstDir, dstName])))
364364
.catch(() => reject(new Error(FileError.ENCODING_ERR)));
365365
})
366366
.catch(() => reject(new Error(FileError.NOT_FOUND_ERR)));
@@ -377,7 +377,7 @@ module.exports = {
377377
*
378378
* @returns {Promise<Object>} The moved file.
379379
*/
380-
moveTo: function ([[srcPath, dstDir, dstName]]) {
380+
moveTo: function ([srcPath, dstDir, dstName]) {
381381
return new Promise((resolve, reject) => {
382382
if (dstName.indexOf('/') !== -1 || path.resolve(srcPath) === path.resolve(dstDir + dstName)) {
383383
reject(new Error(FileError.INVALID_MODIFICATION_ERR));
@@ -390,7 +390,7 @@ module.exports = {
390390
fs.stat(srcPath)
391391
.then((stats) => {
392392
fs.move(srcPath, dstDir + dstName)
393-
.then(async () => resolve(await stats.isDirectory() ? getDirectory([[dstDir, dstName]]) : getFile([[dstDir, dstName]])))
393+
.then(async () => resolve(await stats.isDirectory() ? getDirectory([dstDir, dstName]) : getFile([dstDir, dstName])))
394394
.catch(() => reject(new Error(FileError.ENCODING_ERR)));
395395
})
396396
.catch(() => reject(new Error(FileError.NOT_FOUND_ERR)));
@@ -404,7 +404,7 @@ module.exports = {
404404
* uri: The full path for the file.
405405
* @returns {Promise<Object>} The entry for the file or directory.
406406
*/
407-
resolveLocalFileSystemURI: function ([[uri]]) {
407+
resolveLocalFileSystemURI: function ([uri]) {
408408
return new Promise((resolve, reject) => {
409409
// support for encodeURI
410410
if (/\%5/g.test(uri) || /\%20/g.test(uri)) { // eslint-disable-line no-useless-escape
@@ -478,7 +478,7 @@ module.exports = {
478478
* position: the position offset to start writing from.
479479
* @returns {Promise<Object>} An object with information about the amount of bytes written.
480480
*/
481-
write: function ([[fileName, data, position]]) {
481+
write: function ([fileName, data, position]) {
482482
return new Promise((resolve, reject) => {
483483
if (!data) {
484484
reject(new Error(FileError.INVALID_MODIFICATION_ERR));
@@ -507,7 +507,7 @@ module.exports = {
507507
* size: the length of the file to truncate to.
508508
* @returns {Promise}
509509
*/
510-
truncate: function ([[fullPath, size]]) {
510+
truncate: function ([fullPath, size]) {
511511
return new Promise((resolve, reject) => {
512512
fs.truncate(fullPath, size, err => {
513513
if (err) {
@@ -520,7 +520,7 @@ module.exports = {
520520
});
521521
},
522522

523-
requestFileSystem: function ([[type, size]]) {
523+
requestFileSystem: function ([type, size]) {
524524
if (type !== 0 && type !== 1) {
525525
throw new Error(FileError.INVALID_MODIFICATION_ERR);
526526
}
@@ -590,7 +590,7 @@ function readAs (what, fullPath, encoding, startPos, endPos) {
590590
*
591591
* @returns {Promise<Object>} The file object that is converted to FileEntry by cordova.
592592
*/
593-
function getFile ([[dstDir, dstName, options]]) {
593+
function getFile ([dstDir, dstName, options]) {
594594
const absolutePath = path.join(dstDir, dstName);
595595
options = options || {};
596596
return new Promise((resolve, reject) => {
@@ -662,7 +662,7 @@ function getFile ([[dstDir, dstName, options]]) {
662662
*
663663
* @returns {Promise<Object>} The directory object that is converted to DirectoryEntry by cordova.
664664
*/
665-
function getDirectory ([[dstDir, dstName, options]]) {
665+
function getDirectory ([dstDir, dstName, options]) {
666666
const absolutePath = dstDir + dstName;
667667
options = options || {};
668668
return new Promise((resolve, reject) => {

0 commit comments

Comments
 (0)