Skip to content

Commit c5ba233

Browse files
committed
expose all ytdl functions (fixes #36)
1 parent 6516110 commit c5ba233

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function nextBestFormat(formats) {
1919
return formats.find(format => !format.bitrate) || formats[0];
2020
}
2121

22-
module.exports = function download(url, options = {}) {
22+
function download(url, options = {}) {
2323
return new Promise((resolve, reject) => {
2424
ytdl.getInfo(url, (err, info) => {
2525
if (err) return reject(err);
@@ -55,4 +55,6 @@ module.exports = function download(url, options = {}) {
5555
}
5656
});
5757
});
58-
};
58+
}
59+
60+
module.exports = Object.assign(download, ytdl);

typings/index.d.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
/// <reference types="node" />
1+
import ytdl from 'ytdl-core';
22
import { Readable } from 'stream';
3-
import { downloadOptions, videoFormat } from 'ytdl-core';
4-
export interface PrismVideoFormat extends videoFormat {
5-
audio_sample_rate?: number;
3+
4+
declare function download(link: string, options?: ytdl.downloadOptions): Promise<Readable>;
5+
6+
declare namespace ytdlDiscord {
7+
const newDownload: typeof download & typeof ytdl;
68
}
7-
export declare function download(url: string, options?: downloadOptions): Promise<Readable>;
9+
10+
export = ytdlDiscord.newDownload;

0 commit comments

Comments
 (0)