create-data-uri

1.1.0 • Public • Published

create-data-uri Build Status

Create a base64 data URI

Install

$ npm install --save create-data-uri

Usage

var createDataUri = require('create-data-uri')
 
createDataUri('image/jpeg', 'photo')
//=> data:image/jpeg;base64,photo

API

createDataUri(type, data) -> string

type

Required
Type: string / object

The mime type for the data. You can optionally pass a {type, charset} object as well.

data

Required
Type: string

Base64 encoded data.

License

MIT © Ben Drucker

Readme

Keywords

Package Sidebar

Install

npm i create-data-uri

Weekly Downloads

9

Version

1.1.0

License

MIT

Last publish

Collaborators

  • bendrucker