mobiletto 1.1.18 → 1.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +15 -7
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -462,24 +462,32 @@ async function mobiletto (driverPath, key, secret, opts, encryption = null) {
|
|
|
462
462
|
const files = []
|
|
463
463
|
const promises = []
|
|
464
464
|
for (const entry of entries) {
|
|
465
|
+
const logPrefix = `_loadMeta(${dirent}/${basename(entry.name)})`
|
|
465
466
|
promises.push(new Promise((resolve) => {
|
|
466
467
|
const cipherText = []
|
|
467
|
-
client.read(dirent + '/' + basename(entry.name), reader(cipherText))
|
|
468
|
-
|
|
468
|
+
client.read(dirent + '/' + basename(entry.name), reader(cipherText)).then(
|
|
469
|
+
(bytesRead) => {
|
|
469
470
|
if (!bytesRead) {
|
|
470
|
-
logger.warn(
|
|
471
|
+
logger.warn(`${logPrefix} returned no data`)
|
|
471
472
|
resolve()
|
|
472
473
|
} else {
|
|
473
474
|
const plain = decrypt(cipherText.toString(), enc)
|
|
474
475
|
const realPath = plain.split(ENC_PAD_SEP)[0]
|
|
475
|
-
_metadata(client)(realPath)
|
|
476
|
-
|
|
476
|
+
_metadata(client)(realPath).then(
|
|
477
|
+
(meta) => {
|
|
477
478
|
files.push(meta)
|
|
478
479
|
resolve()
|
|
480
|
+
},
|
|
481
|
+
(err) => {
|
|
482
|
+
logger.warn(`${logPrefix} error fetching _metadata: ${err}`)
|
|
483
|
+
resolve()
|
|
479
484
|
})
|
|
480
485
|
}
|
|
481
|
-
|
|
482
|
-
)
|
|
486
|
+
},
|
|
487
|
+
(err) => {
|
|
488
|
+
logger.warn(`${logPrefix} error reading file: ${err}`)
|
|
489
|
+
resolve()
|
|
490
|
+
})
|
|
483
491
|
}))
|
|
484
492
|
}
|
|
485
493
|
await Promise.all(promises)
|