buffer
buffer copied to clipboard
TypeError: writeUint32LE is not a function
Hi thank you for this library. It makes my life easier :)
I have some problem with this code. It tries to call writeUint32LE
, but it seems to be undefined.
function ttf2eot(arrayBuffer) {
const arr = Buffer.from(arrayBuffer);
const out = Buffer.alloc(SIZEOF.EOT_PREFIX, 0);
out.writeUint32LE(arr.length, EOT_OFFSET.FONT_LENGTH);
out.writeUint32LE(MAGIC.EOT_VERSION, EOT_OFFSET.VERSION);
// other code ...
}
I found a stackoverflow anser here https://stackoverflow.com/a/38543218/2638899 saying that i could use DataView
var dataview = new DataView(arrayBuffer);
dataView.setUint32(0,value);
return dataView.getFloat32(0);
My problem is that ttf2eot
function is based on Buffer
and refactor it with DataView
is not doable.
Do you have any suggestions? Can i use another method instead of writeUint32LE
?