mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 23:37:04 +00:00
got-typings: use proper options for got download
This commit is contained in:
Vendored
+29
-27
@@ -7,33 +7,35 @@
|
||||
|
||||
export = decompress;
|
||||
|
||||
declare function decompress(input: string | Buffer, output: string, opts?: Options): Promise<File>;
|
||||
declare function decompress(input: string | Buffer, output: string, opts?: decompress.DecompressOptions): Promise<decompress.File>;
|
||||
|
||||
interface File {
|
||||
data: Buffer;
|
||||
mode: number;
|
||||
mtime: string;
|
||||
path: string;
|
||||
type: string;
|
||||
}
|
||||
declare namespace decompress {
|
||||
interface File {
|
||||
data: Buffer;
|
||||
mode: number;
|
||||
mtime: string;
|
||||
path: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Filter out files before extracting
|
||||
*/
|
||||
filter?(file: File): boolean;
|
||||
/**
|
||||
* Map files before extracting
|
||||
*/
|
||||
map?(file: File): File;
|
||||
/**
|
||||
* Array of plugins to use.
|
||||
* Default: [decompressTar(), decompressTarbz2(), decompressTargz(), decompressUnzip()]
|
||||
*/
|
||||
plugins?: any[];
|
||||
/**
|
||||
* Remove leading directory components from extracted files.
|
||||
* Default: 0
|
||||
*/
|
||||
strip?: number;
|
||||
interface DecompressOptions {
|
||||
/**
|
||||
* Filter out files before extracting
|
||||
*/
|
||||
filter?(file: File): boolean;
|
||||
/**
|
||||
* Map files before extracting
|
||||
*/
|
||||
map?(file: File): File;
|
||||
/**
|
||||
* Array of plugins to use.
|
||||
* Default: [decompressTar(), decompressTarbz2(), decompressTargz(), decompressUnzip()]
|
||||
*/
|
||||
plugins?: any[];
|
||||
/**
|
||||
* Remove leading directory components from extracted files.
|
||||
* Default: 0
|
||||
*/
|
||||
strip?: number;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+19
-29
@@ -5,38 +5,28 @@
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types="node" />
|
||||
import { DecompressOptions } from 'decompress';
|
||||
import { GotBodyOptions, TimeoutOptions } from 'got';
|
||||
|
||||
interface TimeoutOptions {
|
||||
connect?: number;
|
||||
socket?: number;
|
||||
request?: number;
|
||||
}
|
||||
type RetryFunction = (retry: number, error: any) => number;
|
||||
declare namespace download {
|
||||
type RetryFunction = (retry: number, error: any) => number;
|
||||
|
||||
interface DownloadOptions {
|
||||
body?: string | Buffer | NodeJS.ReadableStream;
|
||||
encoding?: string | null;
|
||||
query?: string | object;
|
||||
timeout?: number | TimeoutOptions;
|
||||
retries?: number | RetryFunction;
|
||||
followRedirect?: boolean;
|
||||
decompress?: boolean;
|
||||
useElectronNet?: boolean;
|
||||
/**
|
||||
* If set to true, try extracting the file using decompress.
|
||||
*/
|
||||
extract?: boolean;
|
||||
/**
|
||||
* Name of the saved file.
|
||||
*/
|
||||
filename?: string;
|
||||
/**
|
||||
* Proxy endpoint
|
||||
*/
|
||||
proxy?: string;
|
||||
interface DownloadOptions extends DecompressOptions, GotBodyOptions<string> {
|
||||
/**
|
||||
* If set to true, try extracting the file using decompress.
|
||||
*/
|
||||
extract?: boolean;
|
||||
/**
|
||||
* Name of the saved file.
|
||||
*/
|
||||
filename?: string;
|
||||
/**
|
||||
* Proxy endpoint
|
||||
*/
|
||||
proxy?: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare namespace download {}
|
||||
declare function download(url: string, destination?: string, options?: DownloadOptions): Promise<Buffer> & NodeJS.WritableStream & NodeJS.ReadableStream;
|
||||
declare function download(url: string, destination?: string, options?: download.DownloadOptions): Promise<Buffer> & NodeJS.WritableStream & NodeJS.ReadableStream;
|
||||
|
||||
export = download;
|
||||
|
||||
Reference in New Issue
Block a user