diff --git a/README.md b/README.md index 9861ed29..e69bd130 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,10 @@ Throws an Error if it fails to parse an ID. 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. Throws an Error if it fails to parse an ID. +### ytdl.version + +The version string taken directly from the package.json. + ## Limitations ytdl cannot download videos that fall into the following diff --git a/lib/index.js b/lib/index.js index a573d78e..0cfbe5ba 100644 --- a/lib/index.js +++ b/lib/index.js @@ -37,6 +37,7 @@ ytdl.cache = { watch: getInfo.watchPageCache, cookie: getInfo.cookieCache, }; +ytdl.version = require('../package.json').version; const createStream = options => { diff --git a/typings/index.d.ts b/typings/index.d.ts index f538f7ae..abb4123d 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -406,6 +406,7 @@ declare module 'ytdl-core' { function validateURL(string: string): boolean; function getURLVideoID(string: string): string | never; function getVideoID(string: string): string | never; + const version: number; } function ytdl(link: string, options?: ytdl.downloadOptions): Readable;