{"id":15690158,"url":"https://github.com/magicdawn/dl-vampire","last_synced_at":"2025-05-07T02:28:55.013Z","repository":{"id":41207627,"uuid":"167149590","full_name":"magicdawn/dl-vampire","owner":"magicdawn","description":"Download file like a vampire","archived":false,"fork":false,"pushed_at":"2025-04-08T16:59:24.000Z","size":868,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-07T02:28:50.036Z","etag":null,"topics":["dl","download","download-manager","fs","vampire"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magicdawn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-23T08:52:09.000Z","updated_at":"2025-04-08T16:59:23.000Z","dependencies_parsed_at":"2024-06-21T02:12:11.763Z","dependency_job_id":"b0ae9618-b231-4187-9f19-a43b131f3284","html_url":"https://github.com/magicdawn/dl-vampire","commit_stats":{"total_commits":88,"total_committers":1,"mean_commits":88.0,"dds":0.0,"last_synced_commit":"338a0408586c301c6e397b0cbcccf5c42d99215a"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdawn%2Fdl-vampire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdawn%2Fdl-vampire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdawn%2Fdl-vampire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicdawn%2Fdl-vampire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magicdawn","download_url":"https://codeload.github.com/magicdawn/dl-vampire/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252801233,"owners_count":21806279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dl","download","download-manager","fs","vampire"],"created_at":"2024-10-03T18:08:01.491Z","updated_at":"2025-05-07T02:28:54.946Z","avatar_url":"https://github.com/magicdawn.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dl-vampire\n\n\u003e download file like a vampire\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/magicdawn/dl-vampire/ci.yml?branch=main\u0026style=flat-square)](https://github.com/magicdawn/dl-vampire/actions/workflows/ci.yml)\n[![Coverage Status](https://img.shields.io/codecov/c/github/magicdawn/dl-vampire.svg?style=flat-square)](https://codecov.io/gh/magicdawn/dl-vampire)\n[![npm version](https://img.shields.io/npm/v/dl-vampire.svg?style=flat-square)](https://www.npmjs.com/package/dl-vampire)\n[![npm downloads](https://img.shields.io/npm/dm/dl-vampire.svg?style=flat-square)](https://www.npmjs.com/package/dl-vampire)\n[![npm license](https://img.shields.io/npm/l/dl-vampire.svg?style=flat-square)](http://magicdawn.mit-license.org)\n\n![vampire](https://cdn.jsdelivr.net/gh/magicdawn/dl-vampire/vampire.jpeg)\n\n## Highlight\n\n- [x] skip mechanism, local file \u0026 content-length\n- [x] retry / timeout support\n- [x] stream to file, not ate memory like the [download](https://github.com/kevva/download/issues?utf8=%E2%9C%93\u0026q=memory+) module\n- [x] download progress support, via awesome [got](https://github.com/sindresorhus/got) module\n\n## Install\n\n```sh\n$ npm i dl-vampire --save\n```\n\n## API\n\n```js\nimport dl, { Vampire, readUrl } from 'dl-vampire'\n```\n\n### `dl(options: DlOptions) =\u003e Promise\u003c{skip: boolean}\u003e`\n\n| name                          | type                 | required | default value                | description                                                                                                           |\n| ----------------------------- | -------------------- | -------- | ---------------------------- | --------------------------------------------------------------------------------------------------------------------- |\n| `options.url`                 | `String`             | `true`   |                              | the download url                                                                                                      |\n| `options.file`                | `String`             | `true`   |                              | the local target file path                                                                                            |\n| `options.onprogress`          | `function(progress)` |          |                              | [got `downloadProgress` event listener](https://github.com/sindresorhus/got#ondownloadprogress-progress)              |\n| `options.retry`               | `Object`             |          | `{times: 5, timeout: false}` | retry options, will pass to [promise.retry](https://github.com/magicdawn/promise.retry#pretry)                        |\n| `options.skipExists`          | `boolean`            |          | `true`                       | if local file already exists _AND_ file stat size match response `content-length` size, the download will be skiped   |\n| `options.expectSize`          | `number`             |          |                              | validate local file `stat.size === expectSize`, if check pass the download will be skiped                             |\n| `options.expectHash`          | `string`             |          |                              | validate local file `file.hash === expectHash`, using `expectHashAlgorithm` if check pass the download will be skiped |\n| `options.expectHashAlgorithm` | `string`             |          | `'md5'`                      | the expect hash algorithm, default `md5`                                                                              |\n| `options.useChromeUa`         | `Boolean`            |          | `true`                       | use `user-agent` of the Chrome Browser                                                                                |\n| `options.useProxyEnv`         | `Boolean`            |          | `true`                       | use `proxy-agent` module, will use `http_proxy` / `https_proxy` / `all_proxy` env variable                            |\n| `options.requestOptions`      | `Object`             |          |                              | custom request options, see [request options](https://github.com/request/request#requestoptions-callback)             |\n\n- if finally the download is skiped, the return promise will resolve to `{skip: true}`\n- else it will resolve to `{skip: false}`\n\n#### `options.retry.*`\n\n| name                    | type                   | description                                                                                                 |\n| ----------------------- | ---------------------- | ----------------------------------------------------------------------------------------------------------- |\n| `options.retry.times`   | `Number`               | max retry times                                                                                             |\n| `options.retry.timeout` | `Number` / `false`     | `false` disables timeout check, `Number`: max wait in ms                                                    |\n| `options.retry.onerror` | `function(err, index)` | when retry happens, this hook will be called, whether a normal error or a timeout error, index is `0` based |\n\nmore see https://github.com/magicdawn/promise.retry\n\n#### `ts types`\n\n```ts\n// options for dl() / readUrl()\nimport type { DlOptions, ReadUrlOptions, ReadUrlOptionsWithEncoding } from 'dl-vampire'\n\n// onpregress type, and progress arg type\nimport type { OnProgress, Progress } from 'dl-vampire'\n```\n\n## Changelog\n\n[CHANGELOG.md](CHANGELOG.md)\n\n## License\n\nthe MIT License http://magicdawn.mit-license.org\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagicdawn%2Fdl-vampire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagicdawn%2Fdl-vampire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagicdawn%2Fdl-vampire/lists"}