# getfile-wo

> Download and extract files without overwriting them

Latest version **8.1.0** (published 2020-09-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install getfile-wo
pnpm add getfile-wo
yarn add getfile-wo
bun add getfile-wo
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 8.1.0 |
| Published | 2020-09-07 |
| First published | 2020-09-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 11 |
| Unpacked size | 6.9 KB |
| Known vulnerabilities | 0 (+4 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Aurelien Surier |
| Maintainers | aureliensurier |
| Keywords | download, extract, http, request, url |

## Links

- npm: https://www.npmjs.com/package/getfile-wo
- Repository: https://github.com/ASGdev/download-wo
- Homepage: https://github.com/ASGdev/download-wo#readme
- Issues: https://github.com/ASGdev/download-wo/issues
- npm.io page: https://npm.io/package/getfile-wo

## Dependencies (11)

- [got](https://npm.io/package/got.md) ^8.3.1
- [pify](https://npm.io/package/pify.md) ^4.0.1
- [p-event](https://npm.io/package/p-event.md) ^2.1.0
- [ext-name](https://npm.io/package/ext-name.md) ^5.0.0
- [make-dir](https://npm.io/package/make-dir.md) ^2.1.0
- [file-type](https://npm.io/package/file-type.md) ^11.1.0
- [decompress](https://npm.io/package/decompress.md) ^4.2.1
- [filenamify](https://npm.io/package/filenamify.md) ^3.0.0
- [get-stream](https://npm.io/package/get-stream.md) ^4.1.0
- [archive-type](https://npm.io/package/archive-type.md) ^4.0.0
- [content-disposition](https://npm.io/package/content-disposition.md) ^0.5.2

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 8.1.0 (latest) — 2020-09-07
- 8.0.2 — 2020-09-06
- 1.0.0 — 2020-09-02

## README

# download-wo (download without overwriting)

> Download and extract files without overwriting by renaming them. Forked from [https://github.com/kevva/download](https://github.com/kevva/download).

> :warning: **Not extensively tested !!**

## Install

```
$ npm install getfile-wo
```


## Usage

```js
const fs = require('fs');
const download = require('getfile-wo');

(async () => {
	await download('http://unicorn.com/foo.jpg', 'dist');

	fs.writeFileSync('dist/foo.jpg', await download('http://unicorn.com/foo.jpg'));

	download('unicorn.com/foo.jpg').pipe(fs.createWriteStream('dist/foo.jpg'));

	await Promise.all([
		'unicorn.com/foo.jpg',
		'cats.com/dancing.gif'
	].map(url => download(url, 'dist')));
})();
```

### Proxies

To work with proxies, read the [`got documentation`](https://github.com/sindresorhus/got#proxies).


## API

### download(url, destination?, options?)

Returns 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).

#### url

Type: `string`

URL to download.

#### destination

Type: `string`

Path to where your file will be written.

#### options

Type: `Object`

Same options as [`got`](https://github.com/sindresorhus/got#options) and [`decompress`](https://github.com/kevva/decompress#options) in addition to the ones below.

##### extract

Type: `boolean`<br>
Default: `false`

If set to `true`, try extracting the file using [`decompress`](https://github.com/kevva/decompress).

##### filename

Type: `string`

Name of the saved file.

##### decode

Type: `boolean`<br>
Default: `true`

Enable URI decoding for more readable file name (e.g replaces "%20" with space).

---
_Source: https://npm.io/package/getfile-wo · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
