Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: writeUint32LE is not a function #319

Open
marcog83 opened this issue Nov 15, 2022 · 0 comments
Open

TypeError: writeUint32LE is not a function #319

marcog83 opened this issue Nov 15, 2022 · 0 comments

Comments

@marcog83
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant