From afea509544fb99bfffe5b0bebe6f3575c53802f0 Mon Sep 17 00:00:00 2001 From: tjacobs3 Date: Wed, 26 Jan 2022 07:30:03 -0500 Subject: [PATCH] fix: page.pdf producing an invalid pdf (#7868) When defining a chunk size for .send('IO.read', { handle, size }), the CDPSession will occasionally indicate that it has reached the end of file without sending a full pdf. This is documented by the associated issue. This behavior is not reproducible when leaving out the size parameter. Since the size parameter is not required on the CDPSession side and is merely a suggestion on the stream side, we can safely leave it out. Issues: #7757 --- src/common/helper.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/helper.ts b/src/common/helper.ts index 098de5a520d..1c20eb93cf4 100644 --- a/src/common/helper.ts +++ b/src/common/helper.ts @@ -356,12 +356,12 @@ async function getReadableFromProtocolStream( let eof = false; return new Readable({ - async read(size: number) { + async read() { if (eof) { return null; } - const response = await client.send('IO.read', { handle, size }); + const response = await client.send('IO.read', { handle }); this.push(response.data, response.base64Encoded ? 'base64' : undefined); if (response.eof) { eof = true;