get-pixels
Advanced tools
Comparing version 3.0.1 to 3.1.0
@@ -123,2 +123,5 @@ 'use strict' | ||
default: | ||
if(Buffer.isBuffer(url)) { | ||
url = 'data:' + type + ';base64,' + url.toString('base64') | ||
} | ||
if(url.indexOf('data:image/gif;') === 0) { | ||
@@ -125,0 +128,0 @@ dataGif(url, cb) |
@@ -128,3 +128,9 @@ 'use strict' | ||
} | ||
if(url.indexOf('data:') === 0) { | ||
if(Buffer.isBuffer(url)) { | ||
if(!type) { | ||
cb(new Error('Invalid file type')) | ||
return | ||
} | ||
doParse(type, url, cb) | ||
} else if(url.indexOf('data:') === 0) { | ||
try { | ||
@@ -131,0 +137,0 @@ var buffer = parseDataURI(url) |
{ | ||
"name": "get-pixels", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"description": "Reads the pixels of an image as an ndarray", | ||
@@ -24,2 +24,3 @@ "main": "node-pixels.js", | ||
"tape": "^2.12.3", | ||
"brfs": "^1.2.0", | ||
"browserify": "^3.44.0", | ||
@@ -30,3 +31,3 @@ "beefy": "^1.1.0" | ||
"test": "tap test/*.js", | ||
"test-browser": "beefy --open --cwd test test.js" | ||
"test-browser": "beefy test/test.js --open -- -t brfs" | ||
}, | ||
@@ -33,0 +34,0 @@ "repository": { |
@@ -34,4 +34,4 @@ get-pixels | ||
* `url` is the path to the file. It can be a relative path, an http url, or a data url | ||
* `type` is an optional mime type for the image | ||
* `url` is the path to the file. It can be a relative path, an http url, a data url, or an [in-memory Buffer](http://nodejs.org/api/buffer.html). | ||
* `type` is an optional mime type for the image (required when using a Buffer) | ||
* `cb(err, pixels)` is a callback which gets triggered once the image is loaded. | ||
@@ -45,2 +45,2 @@ | ||
======= | ||
(c) 2013-2014 Mikola Lysenko. MIT License | ||
(c) 2013-2014 Mikola Lysenko. MIT License |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11024
290
45
4