{"name":"@xhmikosr/downloader","version":"13.0.1","description":"Download and extract files","license":"MIT","repository":{"type":"git","url":"git+https://github.com/XhmikosR/download.git"},"publishConfig":{"access":"public"},"author":{"name":"Kevin Mårtensson","email":"kevinmartensson@gmail.com","url":"https://github.com/kevva"},"engines":{"node":"^14.14.0 || >=16.0.0"},"scripts":{"ava":"ava","lint":"xo","xo":"xo","fix":"xo --fix","test":"npm run xo && npm run ava","test-ci":"c8 ava"},"main":"index.js","type":"module","exports":{".":"./index.js"},"keywords":["download","extract","http","request","url"],"dependencies":{"@xhmikosr/archive-type":"^6.0.1","@xhmikosr/decompress":"^9.0.1","content-disposition":"^0.5.4","ext-name":"^5.0.0","file-type":"^18.5.0","filenamify":"^5.1.1","get-stream":"^6.0.1","got":"^12.6.1","merge-options":"^3.0.4","p-event":"^5.0.1"},"devDependencies":{"ava":"^4.3.3","c8":"^8.0.0","is-zip":"^1.0.0","nock":"^13.3.1","path-exists":"^5.0.0","xo":"^0.54.2"},"xo":{"rules":{"unicorn/prevent-abbreviations":"off"}},"gitHead":"535903a0694e27f099e0509fe7c1ec90819e5b0a","bugs":{"url":"https://github.com/XhmikosR/download/issues"},"homepage":"https://github.com/XhmikosR/download#readme","_id":"@xhmikosr/downloader@13.0.1","_nodeVersion":"18.16.1","_npmVersion":"9.5.1","dist":{"integrity":"sha512-mBvWew1kZJHfNQVVfVllMjUDwCGN9apPa0t4/z1zaUJ9MzpXjRL3w8fsfJKB8gHN/h4rik9HneKfDbh2fErN+w==","shasum":"8478b36606d2108eb86bff419e1df36d84cc262d","tarball":"http://registry-npm.ywwl.com/@xhmikosr/downloader/download/@xhmikosr/downloader-13.0.1.tgz","fileCount":4,"unpackedSize":6819,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBQP34ZoooHLQ8N605Tz3AHZAprM9+v0V4c15AuAawqdAiEAvBmm7ESqTysMv7RI9zPWeMkdZ1aXbVGuG57b8FATLG0="}],"size":2989,"noattachment":false,"key":"/@xhmikosr/downloader/-/@xhmikosr/downloader-13.0.1.tgz"},"_npmUser":{"name":"xhmikosr","email":"xhmikosr@gmail.com"},"directories":{},"maintainers":[{"name":"xhmikosr","email":"xhmikosr@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/downloader_13.0.1_1687525551918_0.9273518845310926"},"_hasShrinkwrap":false,"readme":"# download [![CI](https://github.com/XhmikosR/download/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/XhmikosR/download/actions/workflows/ci.yml)\n\n> Download and extract files\n\n*See [download-cli](https://github.com/kevva/download-cli) for the command-line version.*\n\n\n## Install\n\n```sh\nnpm install @xhmikosr/downloader\n```\n\n\n## Usage\n\n```js\nimport fs from 'node:fs';\nimport download from '@xhmikosr/downloader';\n\n(async () => {\n\tawait download('http://unicorn.com/foo.jpg', 'dist');\n\n\tfs.writeFileSync('dist/foo.jpg', await download('http://unicorn.com/foo.jpg'));\n\n\tdownload('unicorn.com/foo.jpg').pipe(fs.createWriteStream('dist/foo.jpg'));\n\n\tawait Promise.all([\n\t\t'unicorn.com/foo.jpg',\n\t\t'cats.com/dancing.gif'\n\t].map(url => download(url, 'dist')));\n})();\n```\n\n### Proxies\n\nTo work with proxies, read the [`got documentation`](https://github.com/sindresorhus/got#proxies).\n\n\n## API\n\n### download(url, destination?, options?)\n\nReturns both a `Promise<Buffer>` and a [Duplex stream](https://nodejs.org/api/stream.html#stream_class_stream_duplex) with [additional events](https://github.com/sindresorhus/got#streams-1).\n\n#### url\n\nType: `string`\n\nURL to download.\n\n#### destination\n\nType: `string`\n\nPath to where your file will be written.\n\n#### options\n\n##### options.got\n\nType: `Object`\n\nSame options as [`got`](https://github.com/sindresorhus/got#options).\n\n##### options.decompress\n\nSame options as [`decompress`](https://github.com/XhmikosR/decompress#options).\n\n##### extract\n\n* Type: `boolean`\n* Default: `false`\n\nIf set to `true`, try extracting the file using [`decompress`](https://github.com/XhmikosR/decompress).\n\n##### filename\n\nType: `string`\n\nName of the saved file.\n","publish_time":1687525552042,"_cnpm_publish_time":1687525552042,"dist-tags":{"latest":"16.3.1"}}