Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

image-to-blob

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

image-to-blob

a small util to convert image urls to blobs

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

Image to Blob Build Status

Image to Blob is a simple utility that will convert images to blobs this can be used for urls to images, that are not cross domain, and IMG DOM node. Its intended to be used with Browserify.

Install

$ npm install image-to-blob

Example Usage

var imageToBlob = require( 'image-to-blob' ),
    foo = document.getElementById( 'foo' ),
    DOMURL = window.URL || window.webkitURL || window;

function appendBlob( err, blob ) {
    if ( err ) {
        console.error( err );
        return;
    }

    console.log( blob );
    var img = document.createElement( 'img' );
    img.src = DOMURL.createObjectURL( blob );
    document.body.appendChild( img );    
}

imageToBlob( foo, appendBlob );
imageToBlob( './bar.svg', appendBlob );

This will convert SVG images to pngs.

FAQs

Package last updated on 03 Jan 2015

Did you know?

Socket

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.

Install

Related posts