Serialize Uint8Arrays better
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 1.3.0
- Platform / OS version: macOS Sierra
- URLs (if applicable): …
- Node.js version: master
What steps will reproduce the problem?
Please include code that reproduces the issue.
- Open a new page with puppeteer
- Run
page.evaluate(() => new Uint8Array(1024 * 1024 * 10)
What is the expected result?
Puppeteer takes over 20 seconds to serialize/deserialize 10MB and the resulting object is not a Uint8Array.
What happens instead?
A Uint8Array should be returned and it should take a reasonable amount of time (single-digit miliseconds tops and not seconds).
This basically would require inspecting objects returned from evaluate
, detecting they’re Uint8Arrays and then serializing them differently.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:10
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Sending Uint8Array (BSON) in a JSON object
I'm using the 'bson' npm package in the browser for converting / serializing a JSON object to BSON ...
Read more >How to serialize that $%*#ing Buffer
Split the string on the commas into an array and use the from method of the TypedArray to get a Uint8Array . const...
Read more >Uint8Array - JavaScript - MDN Web Docs
Chrome Edge
Uint8Array Full support. Chrome7. Toggle history Full support. Edge12...
Uint8Array() constructor Full support. Chrome7. Toggle history Full support. Edge12...
Constructor without parameters Full support....
Read more >stdlib: JSON Serialization and Deserialization of Exotic ...
Notably, JSON only supports a subset of JavaScript; specifically: plain objects, arrays, strings, numbers, booleans, and null . More exotic objects available in ......
Read more >chainsafe/ssz
length 48 // serialize the object to a byte array const serialized: Uint8Array = Keypair.serialize(keypair); // get the merkle root of the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes of course I was just giving an example - my real code writes a node stream and reads it as a stream on the other side using
fetch
and even backpressure works (I process as quickly as I can on the client andread
).Sure!
Feel free to send a PR