pinokiod 1.2.0 → 1.2.1
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/kernel/api/fs/index.js +16 -1
- package/package.json +1 -1
package/kernel/api/fs/index.js
CHANGED
|
@@ -496,7 +496,7 @@ class FS {
|
|
|
496
496
|
})
|
|
497
497
|
})
|
|
498
498
|
}
|
|
499
|
-
async
|
|
499
|
+
async downloadOne(req, ondata, kernel) {
|
|
500
500
|
await retry(async (bail, number) => {
|
|
501
501
|
ondata({ raw: `\r\n[Attempt ${number}]` })
|
|
502
502
|
console.log("trying", number)
|
|
@@ -507,6 +507,21 @@ class FS {
|
|
|
507
507
|
retries: 10,
|
|
508
508
|
factor: 2
|
|
509
509
|
})
|
|
510
|
+
}
|
|
511
|
+
async download (req, ondata, kernel) {
|
|
512
|
+
let params = req.params
|
|
513
|
+
let url = params.url || params.uri
|
|
514
|
+
if (Array.isArray(url) && params.dir) {
|
|
515
|
+
ondata({ raw: "\r\nURIs:\r\n" + JSON.stringify(url, null, 2).replace(/\n/g, "\r\n") })
|
|
516
|
+
for(let i=0; i<url.length; i++) {
|
|
517
|
+
let u = url[i]
|
|
518
|
+
ondata({ raw: "\r\n[${i+1}/${url.length}] Downloading ${u}\r\n" })
|
|
519
|
+
req.params.url = u
|
|
520
|
+
await this.downloadOne(req, ondata, kernel)
|
|
521
|
+
}
|
|
522
|
+
} else {
|
|
523
|
+
await this.downloadOne(req, ondata, kernel)
|
|
524
|
+
}
|
|
510
525
|
|
|
511
526
|
}
|
|
512
527
|
}
|