1.0.0 • Published 5 years ago

buffer-es v1.0.0

Weekly downloads
2
License
ISC
Repository
-
Last release
5 years ago

Buffer ES

The node.js buffer module made by Feross is a super easy way to convert a typedArray to a buffer that can be serialized with JSON.stringify.

This can be used together with new FileReader() and you can convert the result to a buffer.

const reader = new FileReader();
reader.onload = function(event) {
  const result = event.target.result;
  const filebuffer = Buffer.from(result)
  console.log(JSON.stringify({ file: filebuffer }));
};
reader.readAsArrayBuffer(DOMNODE.files[0]);