@types/download
TypeScript definitions for download
Last updated 5 years ago by types .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install @types/download 
SYNC missed versions from official npm registry.

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

// Type definitions for download 8.0
// Project: https://github.com/kevva/download
// Definitions by: Nico Jansen <https://github.com/nicojs>
//                 BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/// <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

Credits

These definitions were written by Nico Jansen, and BendingBender.

Current Tags

  • 8.0.3                                ...           latest (3 years ago)
  • 6.2.1                                ...           ts2.2 (8 years ago)
  • 6.2.4                                ...           ts2.3 (7 years ago)
  • 6.2.4                                ...           ts2.4 (7 years ago)
  • 6.2.4                                ...           ts2.5 (7 years ago)
  • 6.2.4                                ...           ts2.6 (7 years ago)
  • 6.2.4                                ...           ts2.7 (7 years ago)
  • 6.2.4                                ...           ts2.8 (7 years ago)
  • 6.2.4                                ...           ts2.9 (7 years ago)
  • 6.2.4                                ...           ts3.0 (7 years ago)
  • 6.2.4                                ...           ts3.1 (7 years ago)
  • 6.2.4                                ...           ts3.2 (7 years ago)
  • 6.2.4                                ...           ts3.3 (7 years ago)
  • 6.2.4                                ...           ts3.4 (7 years ago)
  • 6.2.4                                ...           ts3.5 (7 years ago)
  • 8.0.1                                ...           ts3.6 (5 years ago)
  • 8.0.1                                ...           ts3.7 (5 years ago)
  • 8.0.1                                ...           ts3.8 (5 years ago)
  • 8.0.1                                ...           ts3.9 (5 years ago)
  • 8.0.1                                ...           ts4.0 (5 years ago)
  • 8.0.1                                ...           ts4.1 (5 years ago)
  • 8.0.2                                ...           ts4.2 (3 years ago)
  • 8.0.2                                ...           ts4.3 (3 years ago)
  • 8.0.2                                ...           ts4.4 (3 years ago)
  • 8.0.3                                ...           ts4.5 (3 years ago)
  • 8.0.3                                ...           ts4.6 (3 years ago)
  • 8.0.3                                ...           ts4.7 (3 years ago)
  • 8.0.3                                ...           ts4.8 (3 years ago)
  • 8.0.3                                ...           ts4.9 (3 years ago)
  • 8.0.3                                ...           ts5.0 (3 years ago)
  • 8.0.3                                ...           ts5.1 (3 years ago)
  • 8.0.3                                ...           ts5.2 (3 years ago)
  • 8.0.3                                ...           ts5.3 (3 years ago)

9 Versions

  • 8.0.3                                ...           3 years ago
  • 8.0.2                                ...           3 years ago
  • 8.0.1                                ...           5 years ago
  • 8.0.0                                ...           5 years ago
  • 6.2.4                                ...           7 years ago
  • 6.2.3                                ...           7 years ago
  • 6.2.2                                ...           8 years ago
  • 6.2.1                                ...           8 years ago
  • 6.2.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org | Home |