Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@types/download

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/download - npm Package Compare versions

Comparing version 6.2.4 to 8.0.0

62

download/index.d.ts

@@ -1,19 +0,22 @@

// Type definitions for download 6.2
// 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
// TypeScript Version: 2.3
/// <reference types="node" />
import { DecompressOptions } from 'decompress';
import { GotBodyOptions, TimeoutOptions } from 'got';
import { DecompressOptions } from "decompress";
import { GotEmitter, GotOptions } from "got";
import { Duplex } from "stream";
declare namespace download {
type RetryFunction = (retry: number, error: any) => number;
interface DownloadOptions extends DecompressOptions, GotBodyOptions<string> {
interface DownloadOptions extends DecompressOptions, GotOptions<string | null> {
/**
* If set to true, try extracting the file using decompress.
* If set to `true`, try extracting the file using
* [`decompress`](https://github.com/kevva/decompress).
*
* @default false
*/
extract?: boolean;
/**

@@ -23,17 +26,38 @@ * Name of the saved file.

filename?: string;
/**
* Proxy endpoint
*/
proxy?: string;
/**
* Request Headers
*/
headers?: {
[name: string]: string;
};
}
}
declare function download(url: string, destination?: string, options?: download.DownloadOptions): Promise<Buffer> & NodeJS.WritableStream & NodeJS.ReadableStream;
/**
* 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;
{
"name": "@types/download",
"version": "6.2.4",
"version": "8.0.0",
"description": "TypeScript definitions for download",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/download",
"license": "MIT",

@@ -11,9 +12,15 @@ "contributors": [

"githubUsername": "nicojs"
},
{
"name": "BendingBender",
"url": "https://github.com/BendingBender",
"githubUsername": "BendingBender"
}
],
"main": "",
"types": "index",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git"
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/download"
},

@@ -26,4 +33,4 @@ "scripts": {},

},
"typesPublisherContentHash": "25573576743ee4f41301427072830fd3df9f2f464295a9b4ef96885975a6277c",
"typeScriptVersion": "2.3"
"typesPublisherContentHash": "84bd8fda5adbff9bd45be987e46349029f8c600d3827e70432ecff2ef2de9d90",
"typeScriptVersion": "3.6"
}

@@ -8,10 +8,76 @@ # Installation

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/download
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
// 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
Additional Details
* Last updated: Mon, 31 Dec 2018 16:11:57 GMT
* Dependencies: @types/got, @types/decompress, @types/node
/// <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;
/**
* Name of the saved file.
*/
filename?: string;
}
}
/**
* 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: Fri, 04 Jun 2021 18:31:29 GMT
* Dependencies: [@types/got](https://npmjs.com/package/@types/got), [@types/decompress](https://npmjs.com/package/@types/decompress), [@types/node](https://npmjs.com/package/@types/node)
* Global values: none
# Credits
These definitions were written by Nico Jansen <https://github.com/nicojs>.
These definitions were written by [Nico Jansen](https://github.com/nicojs), and [BendingBender](https://github.com/BendingBender).

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc