Comparing version 2.0.2 to 2.0.3
{ | ||
"name": "ipull", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "The only file downloader you'll ever need. Node.js & Browser, CLI and library for fast and reliable file downloads.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -34,3 +34,3 @@ <div align="center"> | ||
### NodeJS API | ||
## NodeJS API | ||
@@ -42,2 +42,3 @@ ```ts | ||
directory: './this/path', | ||
fileName: 'file.large', // optional | ||
cliProgress: true // Show progress bar in the CLI (default: true) | ||
@@ -49,2 +50,22 @@ }); | ||
### Events | ||
```ts | ||
import {downloadFile} from 'ipull'; | ||
const downloader = downloadFile('https://example.com/file.large', { | ||
onInit(engine) { | ||
}, // retrive the file size and other details | ||
onStart(engine) { | ||
}, // download has started | ||
onProgress(engine) { | ||
console.log(`Time left: ${engine.timeLeft}, download speed: ${engine.speed}`) | ||
}, | ||
onFinished(engine) { | ||
}, // download has finished (file is still open) | ||
onClosed(engine) { | ||
} // download has finished and the file is closed | ||
}); | ||
``` | ||
## Browser support | ||
@@ -216,3 +237,6 @@ | ||
const downloader = downloadFile('https://example.com/file.large', { | ||
directory: './this/path' | ||
directory: './this/path', | ||
retry: { | ||
retries: 20 // default: 10 | ||
} | ||
}); | ||
@@ -227,4 +251,7 @@ | ||
### Custom Downloader | ||
<details> | ||
<summary> | ||
<h3>Custom Downloader (click to expand) | ||
</h3> | ||
</summary> | ||
In this example, there will be one progress bar for all the files | ||
@@ -269,2 +296,4 @@ | ||
</details> | ||
<br /> | ||
@@ -271,0 +300,0 @@ |
113559
302