Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
blob-to-buffer
Advanced tools
Say you're using the 'buffer' module on npm, or browserify and you're working with lots of binary data.
Unfortunately, sometimes the browser or someone else's API gives you a Blob
. Silly
browser. How do you convert it to a Buffer
?
Something with a goofy FileReader
thingy... Time to Google for it yet again... There must be a better way!
There is! Simply use this module!
Works in the browser. This module is used by WebTorrent!
npm install blob-to-buffer
var toBuffer = require('blob-to-buffer')
// Get a Blob somehow...
var blob = new Blob([ new Uint8Array([1, 2, 3]) ], { type: 'application/octet-binary' })
toBuffer(blob, function (err, buffer) {
if (err) throw err
buffer[0] // => 1
buffer.readUInt8(1) // => 2
})
MIT. Copyright (c) Feross Aboukhadijeh.
FAQs
Convert a Blob to a Buffer
The npm package blob-to-buffer receives a total of 65,023 weekly downloads. As such, blob-to-buffer popularity was classified as popular.
We found that blob-to-buffer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.