buffer
buffer copied to clipboard
The buffer module from node.js, for the browser.
this library seems to check for BigInt support, however a simple `typeof BigInt` won't suffice using the BigInt syntax (ex. `1n`, `345n`) would cause a [`SyntaxError: identifier starts immediately after...
```js const NodeBuffer = require('node:buffer').Buffer; const BrowserBuffer = require('buffer/').Buffer; console.log(NodeBuffer.from('Hello, world!', 'utf8').toString('base64url')); // works //> 'SGVsbG8sIHdvcmxkIQ' console.log(BrowserBuffer.from('Hello, world!', 'utf8').toString('base64url')); // fails ``` **Error:** ``` Uncaught TypeError: Unknown encoding: base64url slowToString...
Before this pull request, TypeScript didn't accept things like `.readUint8()`, it had to be `.readUInt8()`. I don't like the uppercase notation, so now both are allowed.
Previous link: https://bundle.run/buffer
I'm using this package (version 6.0.3) to run [undici](https://github.com/nodejs/undici) in browser. Undici contains a call to `Buffer#utf8Slice`: https://github.com/nodejs/undici/blob/cab60114da8bf9acc6628daff2ab58f06856bbc9/lib/api/readable.js#L328 Admittedly it's not in the documentation, but as it's in Undici and...
Currently, `buffer.lastIndexOf` behaves differently than node's Buffer when `encoding` is passed as second argument. To reproduce the issue : ``` > node -e "console.log(require('node:buffer').Buffer.from('abcdef').lastIndexOf('b', 'utf8'))" 1 > node -e "console.log(require('buffer/').Buffer.from('abcdef').lastIndexOf('b',...
Hello, In react native, for example using expo fs to write a file or sqllite to write to db, i receive this error `[Error: Exception in HostFunction: unordered_map::at: key not...
[`DataView`](https://developer.mozilla.org/Web/JavaScript/Reference/Global_Objects/DataView)s would simplify a huge amount of the `read*` and `write*` methods. Additionally, using `DataView` would eliminate the need for the `ieee754` dependency. This would save users time and storage...
Following up on #364 and #366, this patch switches the `hexSlice` implementation to use TypedArrays and TextDecoder. It also adds a performance benchmark for `toString('hex')`. In Node on an M3...
In a similar vein to #245, I have an implementation of `toString('hex')` that's between 2x and 4x faster than the existing one, depending on the browser/engine. See: https://jsbench.me/evm3ejel2i/3 Possible drawbacks...