{"name":"@xhmikosr/downloader","version":"9.0.0","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":"github.com/kevva"},"engines":{"node":"^12.20.0 || ^14.14.0 || >=16.0.0"},"scripts":{"ava":"ava","xo":"xo","test":"npm run xo && npm run ava","test-ci":"npm run xo && c8 ava"},"main":"index.js","type":"module","exports":{".":"./index.js"},"keywords":["download","extract","http","request","url"],"c8":{"reporter":["lcovonly","text"]},"dependencies":{"@xhmikosr/decompress":"^5.0.0","archive-type":"^4.0.0","content-disposition":"^0.5.4","ext-name":"^5.0.0","file-type":"^12.4.2","filenamify":"^5.1.1","get-stream":"^6.0.1","got":"^11.8.5","p-event":"^5.0.1"},"devDependencies":{"ava":"^4.3.0","c8":"^7.11.3","is-zip":"^1.0.0","nock":"^13.2.6","path-exists":"^5.0.0","random-buffer":"^0.1.0","xo":"^0.49.0"},"xo":{"rules":{"unicorn/prevent-abbreviations":"off"}},"gitHead":"80ff6a5dd06fd9021e9c846570e57bdb5810fa13","bugs":{"url":"https://github.com/XhmikosR/download/issues"},"homepage":"https://github.com/XhmikosR/download#readme","_id":"@xhmikosr/downloader@9.0.0","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-HrYxZf63OJrH1WRl/H+2eJCoQA5VVRi6vYBHOUIHKx6N6nAFRuuUiomoAsA8ztj/onfLcfsy2JdQuMvSobHXsA==","shasum":"56b79d6b759f559597bed1e628ea222579058bfd","tarball":"http://registry-npm.ywwl.com/@xhmikosr/downloader/download/@xhmikosr/downloader-9.0.0.tgz","fileCount":4,"unpackedSize":6505,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG8GTIxrZSRdzCO0e2IsOzd1TzvAQr/gyBdb8RDEpWuwAiEAuzxFTJyBR7noPxL+xFAh+CJXwUM4fJmaUcDJOa5ahbQ="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkEW3EACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpfxA/9HVklljjVZI6vkx3AEe7eEp0lKh7QF/cQRYQ1g1xzYPZiEO5F\r\nhgJWqJsXeWg/xB72/kVUE7FkHbS7xvGucjzXaRXqOOWK4z+Zm0bcPTc27eu9\r\niEC8gcyln2ivKhUUKX1wgaPQS1XWeibyuTu4VlKpc5TCui0zocVwvJB7Mibr\r\nY19PupLu/zWAcc82A7InvV53k4cLd4y2xFKt11injWQsEIpyVgj2TFgTs+VQ\r\n3gZ+9qY12OBT3VuO3UjSveQtAPRXIo4dYM2cOAXfiQpV78NSm3iv22ZxPtdR\r\n5T9hnXnEO5V6XfRB/Uq9IwtIArue5N1P7PzLmcI80bsA3SfawrM8yONPLTYq\r\n0oUFLboz3ek6tMdEke68FW01sygEJfbiXw5HuiZJ81nbye862g6+Uk9wj4cI\r\noaLhzqwwGi4seZuteMSWlzRAsfcl966SfiWdVP2jIw+EtK75Adzio3eoE4CN\r\nrBdxT7FwzRKAVFoHl/6+cXfXEClcvFLPBC74xZAfhVFJbqH3omEvAHU8Bh0P\r\nsChfydZvkOiQpVcbtMyU878u8PsTY6ACglM6HaEfzOIisWTrf4lZ6ztL5xGo\r\noAyOLF95xKbM6vI6mBjhHdgUoOxCZWMYfiBw0F2BOIMmfq/OXQ+K6bU4PdJH\r\nVd/7+8CusOstBsQdYDuuC21LxomViB73NBU=\r\n=SN6U\r\n-----END PGP SIGNATURE-----\r\n","size":2901,"noattachment":false,"key":"/@xhmikosr/downloader/-/@xhmikosr/downloader-9.0.0.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_9.0.0_1678863812038_0.001683930744652562"},"_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":1678863812242,"_cnpm_publish_time":1678863812242,"dist-tags":{"latest":"16.3.1"}}