chore: revert #7868 to use the size parameter for streaming PDF (#8145)

Issues: #7757
This commit is contained in:
Alex Rudenko 2022-03-18 15:08:25 +01:00 committed by GitHub
parent 8d4067e634
commit 7748730163
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -360,15 +360,12 @@ async function getReadableFromProtocolStream(
let eof = false; let eof = false;
return new Readable({ return new Readable({
async read() { async read(size: number) {
// TODO: use the advised size parameter to read function once
// crbug.com/1290727 is resolved.
// Also, see https://github.com/puppeteer/puppeteer/pull/7868.
if (eof) { if (eof) {
return null; return null;
} }
const response = await client.send('IO.read', { handle }); const response = await client.send('IO.read', { handle, size });
this.push(response.data, response.base64Encoded ? 'base64' : undefined); this.push(response.data, response.base64Encoded ? 'base64' : undefined);
if (response.eof) { if (response.eof) {
eof = true; eof = true;