@guoyunhe/downloader
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

@guoyunhe/downloader

Download large files with minimum RAM usage. Support tar.gz and zip extraction.

Install

npm i @guoyunhe/downloader

Usage

Download a simple file

import { download } from '@guoyunhe/downloader';

await download('https://example.com/logo.png', 'dist/path/logo.png');

Download and extract tar.gz or zip archive

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

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

Package Sidebar

Install

npm i @guoyunhe/downloader

Weekly Downloads

136

Version

1.3.0

License

GPL-3.0

Unpacked Size

47.7 kB

Total Files

7

Last publish

Collaborators

  • guoyunhe