@f/dataurl-to-blob

Turn a dataURL into a blob in a cross-browser way

Stats

StarsIssuesVersionUpdatedCreatedSize
@f/dataurl-to-blob
101.0.05 years ago5 years agoMinified + gzip package size for @f/dataurl-to-blob in KB

Readme

dataurl-to-blob

Build status Git tag NPM version Code style

Turn a dataurl into a blob in a cross-browser way. This code is based on blueimp's canvas-to-blob, with the important difference that it is not a polyfill, and that it can be required (though not used) on the server, which makes it more friendly to server-side rendering.

Installation

$ npm install @f/dataurl-to-blob

Usage

var toBlob = require('@f/dataurl-to-blob')

function canvasToBlob (canvas) {
  return toBlob(canvas.toDataURL('image/png'))
}

API

dataURLToBlob(dataURL)

  • dataURL - The dataURL string. This can be generated from a canvas by calling canvas.toDataURL("image/png").

Returns: A blob buffer of the raw image data

License

MIT

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.