npm i --save https://github.com/Israfil22/stream-save.git
or
npm i --save stream-save
In code:
const createDownloader = requie('stream-saver')
const downloader = createDownloader()
const MB_SIZE_DIVISOR = 1024 * 1024
downloader.onStart((total) => {
console.log(`Total file size: ${total / MB_SIZE_DIVISOR}`)
})
downloader.onPart((total, current) => {
console.log(`Percents: ${current / total * 100}%`)
})
downloader.onEnd((total) => {
console.log('End')
})
downloader.download(process.env.URL, process.env.FILE)
.then((total) => {
console.log(`Success! Total file size: ${total / MB_SIZE_DIVISOR}`)
})
.catch((e) => {
console.log(e)
process.exit(1)
})
- Install Node.js
In shell / cmd npm i -g pkg
npm i
npm run pack
Your build will be located at ./dist folder
Source url & destination url will be prompted from console
Example: streamsaver.exe bulk list=all.json
Sources will be taken from list
execute argument.
list.json file structure:
[
{
"src": "https://url_1.webm",
"dst": "file_record_1.webm"
},
{
"src": "https://url_2.webm",
"dst": "file_record_2.webm"
}
]