# @types/download

> TypeScript definitions for download

Latest version **8.0.5** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/download
pnpm add @types/download
yarn add @types/download
bun add @types/download
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 8.0.5 |
| Published | 2023-11-07 |
| First published | 2017-11-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 6.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51432 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/download
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/download
- npm.io page: https://npm.io/package/@types/download

## Dependencies (3)

- [@types/got](https://npm.io/package/@types/got.md) ^9
- [@types/node](https://npm.io/package/@types/node.md) *
- [@types/decompress](https://npm.io/package/@types/decompress.md) *

## Recent versions

- 8.0.5 (latest) — 2023-11-07
- 8.0.2 (ts4.2) — 2022-12-15
- 8.0.1 (ts3.6) — 2021-07-06
- 6.2.4 (ts2.3) — 2018-12-31
- 6.2.1 (ts2.2) — 2018-01-03
- 8.0.4 — 2023-10-18
- 8.0.3 — 2023-10-10
- 8.0.0 — 2021-06-04
- 6.2.3 — 2018-10-30
- 6.2.2 — 2018-03-22
- 6.2.0 — 2017-11-21

## README

# Installation
> `npm install --save @types/download`

# Summary
This package contains type definitions for download (https://github.com/kevva/download).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/download.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/download/index.d.ts)
````ts
/// <reference types="node" />
import { DecompressOptions } from "decompress";
import { GotEmitter, GotOptions } from "got";
import { Duplex } from "stream";

declare namespace download {
    interface DownloadOptions extends DecompressOptions, GotOptions<string | null> {
        /**
         * If set to `true`, try extracting the file using
         * [`decompress`](https://github.com/kevva/decompress).
         *
         * @default false
         */
        extract?: boolean | undefined;

        /**
         * Name of the saved file.
         */
        filename?: string | undefined;
    }
}

/**
 * Download and extract files.
 *
 * @param url URL to download.
 * @param destination Path to where your file will be written.
 * @param options Same options as [`got`](https://github.com/sindresorhus/got#options)
 * and [`decompress`](https://github.com/kevva/decompress#options) in addition to the
 * ones from this package.
 *
 * @example
 * import fs from 'fs';
 * import download = require('download');
 *
 * (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')));
 * })();
 */
declare function download(
    url: string,
    destination?: string,
    options?: download.DownloadOptions,
): Promise<Buffer> & GotEmitter & Duplex;
declare function download(url: string, options?: download.DownloadOptions): Promise<Buffer> & GotEmitter & Duplex;

export = download;

````

### Additional Details
 * Last updated: Mon, 06 Nov 2023 22:41:05 GMT
 * Dependencies: [@types/decompress](https://npmjs.com/package/@types/decompress), [@types/got](https://npmjs.com/package/@types/got), [@types/node](https://npmjs.com/package/@types/node)

# Credits
These definitions were written by [Nico Jansen](https://github.com/nicojs), and [BendingBender](https://github.com/BendingBender).

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