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

buffer as a string #3

Closed
crdx opened this issue Dec 1, 2018 · 3 comments
Closed

buffer as a string #3

crdx opened this issue Dec 1, 2018 · 3 comments

Comments

@crdx
Copy link

crdx commented Dec 1, 2018

Just curious, what's the reason behind splitting up the string "buffer"?

function toUint8Array (s) {
  if (typeof atob === 'function') return new Uint8Array(atob(s).split('').map(charCodeAt))
  return new (require('buf' + 'fer').Buffer)(s, 'base64')
}

https://github.com/thlorenz/wasm2js/blob/master/wasm2js.js#L70

@crdx
Copy link
Author

crdx commented Dec 1, 2018

Might be more a question for @mafintosh as I see now this code originally came from wat2js.

@mafintosh
Copy link
Collaborator

mafintosh commented Dec 1, 2018 via email

@crdx
Copy link
Author

crdx commented Dec 1, 2018

Ah, I see. Thanks!

@crdx crdx closed this as completed Dec 1, 2018
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

2 participants