Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

datauri

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datauri - npm Package Compare versions

Comparing version 0.5.5 to 0.6.0

2

lib/datauri/module.js

@@ -20,4 +20,2 @@ /*

EventEmitter.call(this);
if (!(this instanceof DataURI)) {

@@ -24,0 +22,0 @@ datauri = new DataURI();

8

package.json
{
"name": "datauri",
"version": "0.5.5",
"description": "Data-URI scheme tools and generators",
"version": "0.6.0",
"description": "A simple Data URI scheme module and client for Node.js and io.js",
"main": "datauri.js",

@@ -10,4 +10,4 @@ "scripts": {

"dependencies": {
"mimer": "~0.2.1",
"rsvp": "~3.0.3"
"mimer": "^0.2.1",
"rsvp": "^3.0.16"
},

@@ -14,0 +14,0 @@ "repository": {

@@ -1,5 +0,5 @@

datauri [![Build Status](https://secure.travis-ci.org/heldr/datauri.png?branch=master)](http://travis-ci.org/heldr/datauri) [![Coverage Status](https://coveralls.io/repos/heldr/datauri/badge.png)](https://coveralls.io/r/heldr/datauri) [![NPM version](https://badge.fury.io/js/datauri.png)](http://badge.fury.io/js/datauri)
=======
# datauri
[![Build Status](http://img.shields.io/travis/heldr/datauri/master.svg?style=flat)](http://travis-ci.org/heldr/datauri) [![Coverage Status](http://img.shields.io/coveralls/heldr/datauri/master.svg?style=flat)](https://coveralls.io/r/heldr/datauri) [![NPM version](http://img.shields.io/npm/dm/datauri.svg?style=flat)](https://www.npmjs.org/package/datauri)
A simple [Data URI scheme][datauri] generator built on top of [Node.js][nodejs]. To install datauri, just run:
A simple [Data URI scheme][datauri] module and client for [Node.js][nodejs] and [io.js][iojs]. To install datauri, just run:

@@ -9,4 +9,3 @@ `npm install -g datauri` (it may require Root privileges)

CLIENT
------
## CLIENT

@@ -29,4 +28,3 @@ ### Print datauri scheme

API
---
## MODULE

@@ -49,4 +47,4 @@ ### Function

console.log(dUri.base64); //=> "iVBORw0KGgoAAAANSUhEUgAA..."
console.log(dUri.getCSS()); //=> "\n.case {\n background: url('data:image/png;base64,iVBORw..."
console.log(dUri.getCSS("myClass")); //=> "\n.myClass {\n background: url('data:image/png;base64,iVBORw..."
console.log(dUri.getCss()); //=> "\n.case {\n background: url('data:image/png;base64,iVBORw..."
console.log(dUri.getCss("myClass")); //=> "\n.myClass {\n background: url('data:image/png;base64,iVBORw..."
```

@@ -79,4 +77,4 @@

console.log(this.base64); //=> "iVBORw0KGgoAAAANSUhEUgAA..."
console.log(this.getCSS()); //=> "\n.case {\n background: url('data:image/png;base64,iVBORw..."
console.log(this.getCSS("myClass")); //=> "\n.myClass {\n background: url('data:image/png;base64,iVBORw..."
console.log(this.getCss()); //=> "\n.case {\n background: url('data:image/png;base64,iVBORw..."
console.log(this.getCss("myClass")); //=> "\n.myClass {\n background: url('data:image/png;base64,iVBORw..."
})

@@ -102,4 +100,4 @@ .on('error', function (content) {

console.log(this.base64); //=> "iVBORw0KGgoAAAANSUhEUgAA..."
console.log(this.getCSS()); //=> "\n.case {\n background: url('data:image/png;base64,iVBORw..."
console.log(this.getCSS("myClass")); //=> "\n.myClass {\n background: url('data:image/png;base64,iVBORw..."
console.log(this.getCss()); //=> "\n.case {\n background: url('data:image/png;base64,iVBORw..."
console.log(this.getCss("myClass")); //=> "\n.myClass {\n background: url('data:image/png;base64,iVBORw..."
});

@@ -132,6 +130,26 @@

console.log(dUri.base64); //=> "eGtjZA=="
console.log(dUri.getCSS("myClassName")); //=> "\n.myClassName {\n background: url('data:image/png;base64,eGtjZA==..."
console.log(dUri.getCss("myClassName")); //=> "\n.myClassName {\n background: url('data:image/png;base64,eGtjZA==..."
```
### Create from a Buffer
If you already have your file as a Buffer, use this. It's much faster than passing a string.
```js
var Datauri = require('datauri'),
dUri = new Datauri();
//...
var buffer = fs.readFileSync('./hello');
//...
dUri.format('.png', buffer);
console.log(dUri.content); //=> "data:image/png;base64,eGtjZA=="
console.log(dUri.mimetype); //=> "image/png"
console.log(dUri.base64); //=> "eGtjZA=="
console.log(dUri.getCss("myClassName")); //=> "\n.myClassName {\n background: url('data:image/png;base64,eGtjZA==..."
```
GRUNT

@@ -148,2 +166,7 @@ -----

GULP
-----
* [gulp-image-data-uri](https://github.com/adam-lynch/gulp-image-data-uri) - A [Gulp](http://github.com/gulpjs/gulp) plugin for converting images to inline data-URIs. Intended to be a simple single-purpose wrapper for [heldr/datauri](https://github.com/heldr/datauri).
DEVELOPING

@@ -167,2 +190,3 @@ ----------

* 0.6 - io.js support
* 0.5 - Format data uri from a string

@@ -180,3 +204,4 @@ * 0.4 - Promises support

[nodejs]: http://nodejs.org/download
[iojs]: https://iojs.org/
[datauri]: http://en.wikipedia.org/wiki/Data_URI_scheme
[promisesaplus]: http://promises-aplus.github.io/promises-spec/
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc