Skip to content

Commit

Permalink
Work around issue with handling large sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jul 1, 2023
1 parent 0a81854 commit e58d141
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import {Buffer, constants as BufferConstants} from 'node:buffer';
import {PassThrough as PassThroughStream} from 'node:stream';
import {pipeline as streamPipeline} from 'node:stream/promises';

const maxHighWaterMark = 2_147_483_647;

export class MaxBufferError extends Error {
name = 'MaxBufferError';

Expand All @@ -28,7 +30,7 @@ export default async function getStream(inputStream, options) {
encoding = null;
}

const stream = new PassThroughStream();
const stream = new PassThroughStream({highWaterMark: maxHighWaterMark});

if (encoding) {
stream.setEncoding(encoding);
Expand Down

0 comments on commit e58d141

Please sign in to comment.