1.1.203 • Published 3 years ago

stream-save v1.1.203

Weekly downloads
8
License
ISC
Repository
github
Last release
3 years ago

StreamSaver

As package using

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 / Build

  1. Install Node.js
    In shell / cmd
  2. npm i -g pkg
  3. npm i
  4. npm run pack

Your build will be located at ./dist folder

Mode

Without flags specifying

Source url & destination url will be prompted from console

Bulk flag

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"
    }
]
1.1.203

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago