Skip to content

Commit

Permalink
feat: expose version (#832)
Browse files Browse the repository at this point in the history
* expose version

* add to typings
  • Loading branch information
TimeForANinja committed May 4, 2021
1 parent 838de41 commit 374bbd8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/index.js
Expand Up @@ -37,6 +37,7 @@ ytdl.cache = {
watch: getInfo.watchPageCache,
cookie: getInfo.cookieCache,
};
ytdl.version = require('../package.json').version;


const createStream = options => {
Expand Down
1 change: 1 addition & 0 deletions typings/index.d.ts
Expand Up @@ -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;
Expand Down

0 comments on commit 374bbd8

Please sign in to comment.