JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 307243
  • Score
    100M100P100Q182635F
  • License MIT

Convert a Blob to a Buffer

Package Exports

  • blob-to-buffer

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (blob-to-buffer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

blob-to-buffer travis npm downloads gittip

Convert a Blob to a Buffer.

browser support

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 aBuffer? What's that goofy FileReader code look like? 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!

install

npm install blob-to-buffer

usage

var toBuffer = require('blob-to-buffer')

// Get a Blob somehow...
var blob = new Blob([ new Uint8Array([1, 2, 3]) ], { type: 'application/octet-binary' })

var buffer = toBuffer(blob)

buffer[0] // => 1
buffer.readUInt8(1) // => 2

license

MIT. Copyright (c) Feross Aboukhadijeh.