Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stefanhuber/web-downloader
https://github.com/stefanhuber/web-downloader
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/stefanhuber/web-downloader
- Owner: stefanhuber
- License: mit
- Created: 2020-07-23T13:27:29.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T12:15:54.000Z (almost 2 years ago)
- Last Synced: 2024-04-14T22:45:46.534Z (7 months ago)
- Language: TypeScript
- Size: 1.24 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Web Downloader
# Usage Example
```typescript
import { FileDownloader, NodeFileHandler } from "web-downloader";const fileDownloader = new FileDownloader(
new NodeFileHandler('/var/tmp/sample/directory'),
[
{ source: 'https://testtest.com/123.jpg', target: 'myimage1.jpg' },
{ source: 'https://testtest.com/555555.jpg', target: 'myimage2.jpg' },
// other files ...
]
);fileDownloader.once('progress', (event) => {
console.log(`${Math.floor(event.progress * 100)}% of files have been downloaded...`);
});fileDownloader.once('complete', () => {
// all files are downloaded
});fileDownloader.once('error', () => {
// file download could not be complete
});fileDownloader.download();
```