From ced620c95953048a6e37ba2d435ee8b02d4051c9 Mon Sep 17 00:00:00 2001 From: tjacobs3 Date: Wed, 22 Dec 2021 16:12:19 -0500 Subject: [PATCH] fix: page.pdf producing an invalid pdf When defining a chunk size for .send('IO.read', { handle, size }), the CDPSession will occassionally indicate an that it has reached the end of file without sending a full pdf. This is documented by the associated issue. This behavior is not reproducable 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. Refs: #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 098de5a520de4..1c20eb93cf4a3 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;