/*
Using nodejs' fs module you can create a WriteStream
to handle raw stream of bytes and buffers.
*/
const path = "path/to/the/file";
array = BigInt64Array(0);
buffer = Buffer.from(array.buffer)
fs.createWriteStream(path).write(buffer);
fs = require('fs');
fs.writeFile('helloworld.txt', 'Hello World!', function (err) {
if (err) return console.log(err);
console.log('Hello World > helloworld.txt');
});
function bufferToFile(
buffer,
filename,
type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
) {
let blob = new Blob([buffer], { type });
const anchor = document.createElement('a');
const url = URL.createObjectURL(blob);
anchor.href = url;
anchor.download = filename;
document.body.appendChild(anchor);
anchor.click();
document.body.removeChild(anchor);
URL.revokeObjectURL(url);
}