-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Finish native Buffer
implementation
#155
Comments
Just an extra comment related to some of the other issues: console.log(Buffer.from('').constructor === Buffer);
console.log(Object.getPrototypeOf(Buffer.from('')).constructor === Buffer); On Node.js, this will log "true" both times. In Bun it logs "false" both times. Obviously this is because Buffer in Bun is basically an API layered on top of Typed Arrays, but if you want full transparent parity, the constructors will need to be arranged correctly too. (I just happened to stumble into this while doing something admitteddly a little weird) ... in Node, it appears to be the case that Buffer is simply a child of Uint8Array:
(edit) TIL how prototypes get set up when using "extends". While Node seems to be manually setting things up rather than using "class" syntax, the net effect is equivalent to what you'd get by writing Bun's Buffer, instead, appears to behave like |
List is incomplete.
|
@asilvas those functions will land in the next canary build (later tonight), thanks to @alexlamsl in #2341 (along with previously failing tests imported from Node.js that have been fixed) The remaining todo here is to speed up |
Bun's
Buffer
implementation is incomplete and I think it'd be good to have an issue where this is tracked.Buffer
static functions:Buffer.prototype
functions:Bugs
buffer.write(foo, "base64")
loses the last letter sometimesbuffer.write(foo, "base64url")
is too slowBuffer.concat
in a tight loop is not yet faster than Node. I expect it to improve once pooling is added, but I don't think that's the entire story here.Once finished:
"buffer"
package should point to the native instancebuffer.Blob
in"buffer"
module should point toglobalThis.Blob
"crypto"
polyfill should use the native Buffer implementationThe text was updated successfully, but these errors were encountered: