@types/download

  • Version 8.0.5
  • Published
  • 6.42 kB
  • 3 dependencies
  • MIT license

Install

npm i @types/download
yarn add @types/download
pnpm add @types/download

Overview

TypeScript definitions for download

Index

Functions

function download

download: {
(
url: string,
destination?: string,
options?: download.DownloadOptions
): Promise<Buffer> & GotEmitter & Duplex;
(url: string, options?: download.DownloadOptions): any;
};
  • Download and extract files.

    Parameter url

    URL to download.

    Parameter destination

    Path to where your file will be written.

    Parameter 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 1

    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'))); })();

Interfaces

interface DownloadOptions

interface DownloadOptions extends DecompressOptions, GotOptions<string | null> {}

    property extract

    extract?: boolean | undefined;
    • If set to true, try extracting the file using [decompress](https://github.com/kevva/decompress).

      false

    property filename

    filename?: string | undefined;
    • Name of the saved file.

    Package Files (1)

    Dependencies (3)

    Dev Dependencies (0)

    No dev dependencies.

    Peer Dependencies (0)

    No peer dependencies.

    Badge

    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/download.

    • Markdown
      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/download)
    • HTML
      <a href="https://www.jsdocs.io/package/@types/download"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>