Skip to content

Commit

Permalink
docs(typings): separate download options, getInfo() options, `choos…
Browse files Browse the repository at this point in the history
…eFormat()` options

fixes #743
  • Loading branch information
fent committed Nov 1, 2020
1 parent bd8ceca commit 969c4ff
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,26 @@ declare module 'ytdl-core' {

namespace ytdl {
type Filter = 'audioandvideo' | 'videoandaudio' | 'video' | 'videoonly' | 'audio' | 'audioonly' | ((format: videoFormat) => boolean);
interface downloadOptions {

interface getInfoOptions {
lang?: string;
requestOptions?: {};
}

interface chooseFormatOptions {
quality?: 'lowest' | 'highest' | 'highestaudio' | 'lowestaudio' | 'highestvideo' | 'lowestvideo' | string | number | string[] | number[];
filter?: Filter;
format?: videoFormat;
}

interface downloadOptions extends getInfoOptions, chooseFormatOptions {
range?: {
start?: number;
end?: number;
};
begin?: string | number | Date;
liveBuffer?: number;
requestOptions?: {};
highWaterMark?: number;
lang?: string;
dlChunkSize?: number;
}

Expand Down Expand Up @@ -348,10 +355,10 @@ declare module 'ytdl-core' {
thumbnail_ids?: string;
}

function getBasicInfo(url: string, options?: downloadOptions): Promise<videoInfo>;
function getInfo(url: string, options?: downloadOptions): Promise<videoInfo>;
function getBasicInfo(url: string, options?: getInfoOptions): Promise<videoInfo>;
function getInfo(url: string, options?: getInfoOptions): Promise<videoInfo>;
function downloadFromInfo(info: videoInfo, options?: downloadOptions): Readable;
function chooseFormat(format: videoFormat | videoFormat[], options?: downloadOptions): videoFormat | never;
function chooseFormat(format: videoFormat | videoFormat[], options?: chooseFormatOptions): videoFormat | never;
function filterFormats(formats: videoFormat | videoFormat[], filter?: Filter): videoFormat[];
function validateID(string: string): boolean;
function validateURL(string: string): boolean;
Expand Down

0 comments on commit 969c4ff

Please sign in to comment.