1.1.2 • Published 2 years ago

youtube-dl-progress-improved v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

An Improved Node.js Wrapper for YoutubeDL

youtube-dl conventionally makes it very hard to get progress information on the status of a download. This module implements a new function download which returns a ProgressPromise. This promise allows you to get the status of the download, but also implements a progress method for you to be informed of the file's size and download progress.

Arguments

See youtube-dl-exec for a listing of the arguments which can be passed to youtube-dl.

Options

We also accept an options object which only has a single option at the moment:

  • timeout: How many ms after which we should abort the download. Set to false to never timeout.

Example

const { download } = require('youtube-dl-progress-improved')

const promise = download("https://www.youtube.com/watch?v=dQw4w9WgXcQ", {
  // youtube-dl options go here:
  format: 'bestvideo[height <=? 480]+bestaudio/best[height <=? 480]',
}, {
  // our options go here, currently that's only:
  timeout: 60 * 1000,
})

promise.progress((value) => {
  console.log(value.percentage, value.totalSizeBytes, value.timeRemainingSeconds, value.rateBytesPerSecond)
})

promise.then(() => {
  console.log("Download completed")
}, (err) => {
  console.error("Error downloading", err)
})

// You can also cancel a download:
promise.cancel()

// A cancelled download will reject, but `promise.cancelled` will be true
1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago