Convert bson file to json with javascript

1 · Bogdan Alexandru Militaru · April 3, 2023, 2:39 p.m.
How to convert bson file to json with javascript with a simple script file. Followup this simple proces Save the following file into index.js const fs = require('fs') const BSON = require('bson') function BSON2JSON (from) { const buffer = fs.readFileSync(from) let index = 0 const documents = [] while (buffer.length > index) { index = BSON.deserializeStream(buffer, index, 1, documents, documents.length) } return documents } const bsonFilePath = 'file.bson' const bson2json = BSO...