Skip to content

Commit

Permalink
feat: highWaterMark now defaults to 512KB, to avoid issues with dis…
Browse files Browse the repository at this point in the history
…cord.js streams ending early

closes #402
  • Loading branch information
fent committed Apr 12, 2020
1 parent 7020f27 commit f4a9b65
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -56,7 +56,7 @@ Attempts to download a video from the given url. Returns a [readable stream](htt
* This option is not very reliable, see [#129](https://github.com/fent/node-ytdl-core/issues/129), [#219](https://github.com/fent/node-ytdl-core/issues/219).
* `liveBuffer` - How much time buffer to use for live videos in milliseconds. Default is `20000`.
* `requestOptions` - Anything to merge into the request options which [miniget](https://github.com/fent/node-miniget) is called with, such as `headers`.
* `highWaterMark` - How much of the video download to buffer into memory. See [node's docs](https://nodejs.org/api/stream.html#stream_constructor_new_stream_writable_options) for more.
* `highWaterMark` - How much of the video download to buffer into memory. See [node's docs](https://nodejs.org/api/stream.html#stream_constructor_new_stream_writable_options) for more. Defaults to 512KB.
* `lang` - The 2 character symbol of a language. Default is `en`.

#### Event: info
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Expand Up @@ -43,7 +43,7 @@ ytdl.cache = {

const createStream = options => {
const stream = new PassThrough({
highWaterMark: (options && options.highWaterMark) || null,
highWaterMark: (options && options.highWaterMark) || 1024 * 512,
});
stream.destroy = () => { stream._isDestroyed = true; };
return stream;
Expand Down

0 comments on commit f4a9b65

Please sign in to comment.