https://github.com/guoyunhe/downloader
Download and extract archives (zip, tar.gz) with less RAM usage
https://github.com/guoyunhe/downloader
Last synced: about 1 month ago
JSON representation
Download and extract archives (zip, tar.gz) with less RAM usage
- Host: GitHub
- URL: https://github.com/guoyunhe/downloader
- Owner: guoyunhe
- License: gpl-3.0
- Created: 2023-01-22T01:02:50.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-29T09:47:11.000Z (over 2 years ago)
- Last Synced: 2024-09-29T01:04:28.132Z (8 months ago)
- Language: TypeScript
- Size: 35.2 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# @guoyunhe/downloader
Download large files with minimum RAM usage. Support tar.gz and zip extraction.
## Install
```bash
npm i @guoyunhe/downloader
```## Usage
Download a simple file
```ts
import { download } from '@guoyunhe/downloader';await download('https://example.com/logo.png', 'dist/path/logo.png');
```Download and extract tar.gz or zip archive
```ts
import { download } from '@guoyunhe/downloader';await download('https://example.com/data.tar.gz', 'dist/path/', { extract: true });
// Output:
// └── export-2023-01-01
// └── data
// ├── spec.xml
// ├── report.pdf
// └── raw.dat
```Reduce extraction file path by two folder
```ts
import { download } from '@guoyunhe/downloader';await download('https://example.com/data.tar.gz', 'dist/path/', { extract: true, strip: 2 });
// Output:
// ├── spec.xml
// ├── report.pdf
// └── raw.dat
```