Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/philipjscott/partial-load
Download part of a file :floppy_disk:
https://github.com/philipjscott/partial-load
Last synced: about 1 month ago
JSON representation
Download part of a file :floppy_disk:
- Host: GitHub
- URL: https://github.com/philipjscott/partial-load
- Owner: philipjscott
- License: mit
- Created: 2018-08-19T17:49:32.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-08-31T21:30:31.000Z (over 6 years ago)
- Last Synced: 2024-11-01T18:11:58.576Z (about 2 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/partial-load
- Size: 63.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# partial-load
Download part of a file.
## Installation
```bash
$ yarn add partial-load# Or,
$ npm install partial-load --save
```## Usage
```js
const partialDownload = require('partial-load')const url = 'https://www.w3schools.com/html/mov_bbb.webm'
const megabyte = 1024 * 1024// stop loading once 1MB has been exceeded
partialDownload(url, './output/file.webm', megabyte)
.then((bytes) => console.log('Downloaded ', bytes, ' bytes!'))
```## API
#### partialLoad(url, output, byteLimit)
Returns of a `Promise` which resolves to the number of loaded bytes.
#### url
Type: `String`
The url of the file.
#### output
Type: `String`
The file path of the output, assumes directory exists.
#### byteLimit
Type: `Number`
The byte limit threshold; the load will stop once the byte limit has been exceeded.