Skip to content

Commit 374bbd8

Browse files
feat: expose version (#832)
* expose version * add to typings
1 parent 838de41 commit 374bbd8

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ Throws an Error if it fails to parse an ID.
140140
Same as the above `ytdl.getURLVideoID()`, but can be called with the video ID directly, in which case it returns it. This is what ytdl uses internally.
141141
Throws an Error if it fails to parse an ID.
142142

143+
### ytdl.version
144+
145+
The version string taken directly from the package.json.
146+
143147
## Limitations
144148

145149
ytdl cannot download videos that fall into the following

lib/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ ytdl.cache = {
3737
watch: getInfo.watchPageCache,
3838
cookie: getInfo.cookieCache,
3939
};
40+
ytdl.version = require('../package.json').version;
4041

4142

4243
const createStream = options => {

typings/index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ declare module 'ytdl-core' {
406406
function validateURL(string: string): boolean;
407407
function getURLVideoID(string: string): string | never;
408408
function getVideoID(string: string): string | never;
409+
const version: number;
409410
}
410411

411412
function ytdl(link: string, options?: ytdl.downloadOptions): Readable;

0 commit comments

Comments
 (0)