bun
bun copied to clipboard
`SegmentationFault at 3` when parsing a large JSON file
trafficstars
–––– bun meta ––––
Bun v0.0.83 macOS Silicon 21.4.0
AutoCommand: public_folder
Elapsed: 598ms | User: 29ms | Sys: 34ms
RSS: 54.62MB | Peak: 54.62MB | Commit: 0.27GB | Faults: 732
–––– bun meta ––––
Reproduction: https://github.com/lawrencecchen/stripe-sync/tree/1a49d8cf81ab573d39e823f8eef06d717e3efdd6
bun index.ts
thanks for reporting
I think the issue is in the console.log implementation. Seems to stack overflow on large objects
If you do JSON.stringify(object) it works
Tested on MacOS with 0.2.2, looks like this issue is fixed.
const response = await fetch(
"https://raw.githubusercontent.com/json-iterator/test-data/master/large-file.json",
{
headers: {
"Accept-Encoding": "identity",
}
}
);
const body = await response.text();
const json = JSON.parse(body);
console.log(json);