Skip to content

Commit

Permalink
docs(cache): Add new typedef for returned cache
Browse files Browse the repository at this point in the history
- Declared a new typedef, `ExtractedVideoInfoCacheObject`, to represents the parsed and extracted cache of video information object
- Changed the returned type in `getCache` and `getAllCaches` functions
  • Loading branch information
mitsuki31 committed Jan 24, 2025
1 parent c1e500d commit 3df99f5
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions lib/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,21 @@
* @property {string} authorName - The name of the author of the video or `'<unknown>'` if not available.
* @property {string} videoUrl - The URL of the video.
* @property {string} authorUrl - The URL of the author of the video (refers to author profile).
* @property {Object} videoInfo - The video information object.
* @property {Object} videoInfo - The sealed video information object.
* @property {'zlib/bin'} videoInfo.type - The type of the video information.
* @property {ytdl.videoInfo} videoInfo.data - The video information data.
* @property {string} videoInfo.data - The compressed and binary encoded video information data.
* @global
* @since 2.0.0
*/

/**
* @typedef {Object} ExtractedVideoInfoCacheObject
* @property {string} id - The ID of the video.
* @property {string} title - The title of the video or `'<unknown>'` if not available.
* @property {string} authorName - The name of the author of the video or `'<unknown>'` if not available.
* @property {string} videoUrl - The URL of the video.
* @property {string} authorUrl - The URL of the author of the video (refers to author profile).
* @property {ytdl.videoInfo} videoInfo - The extracted and unsealed video information object.
* @global
* @since 2.0.0
*/
Expand Down Expand Up @@ -377,7 +389,7 @@ class VInfoCache {
* for checking the stored cache information.
* @param {boolean} [cacheOptions.validate] - Whether to validate the cache object before returning it.
*
* @returns {Promise.<VideoInfoCacheObject | string | null>}
* @returns {Promise.<ExtractedVideoInfoCacheObject | string | null>}
* A promise that resolves to the cached video information object, a cache formatted into a simple human-readable string
* if the `cacheOptions.humanReadable` option is enabled, or `null` if the cache does not exist.
*
Expand Down Expand Up @@ -479,7 +491,7 @@ class VInfoCache {
* for checking the stored cache information.
* @param {boolean} [cacheOptions.validate] - Whether to validate for each cache object.
*
* @returns {Promise.<Array.<VideoInfoCacheObject> | string>}
* @returns {Promise.<Array.<ExtractedVideoInfoCacheObject> | string>}
* A promise that resolves to an array of cache contents, a cache formatted into a simple human-readable string
* if the `cacheOptions.humanReadable` option is enabled, or an empty array if no caches are found.
*
Expand Down

0 comments on commit 3df99f5

Please sign in to comment.