node-base64-image
Advanced tools
Comparing version 0.1.2 to 1.0.0
{ | ||
"name": "node-base64-image", | ||
"version": "0.1.2", | ||
"version": "1.0.0", | ||
"description": "Download images from remote URLs and encode/decode them to base64", | ||
"main": "index.js", | ||
"main": "dist/node-base64-image.js", | ||
"scripts": { | ||
"test": "mocha test/tests.js" | ||
"test": "gulp", | ||
"lint": "gulp lint", | ||
"test-browser": "gulp test-browser", | ||
"watch": "gulp watch", | ||
"build": "babel src --presets babel-preset-es2015 --out-dir dist", | ||
"coverage": "gulp coverage", | ||
"tag": "gulp tag", | ||
"doc": "gulp doc", | ||
"prepublish": "npm run build && npm run coverage && npm run tag" | ||
}, | ||
"engines": { | ||
"node": ">=0.10" | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/riyadhalnur/node-base64-image.git" | ||
}, | ||
"repository": "https://github.com/riyadhalnur/node-base64-image", | ||
"homepage": "http://riyadhalnur.github.io/node-base64-image/", | ||
"keywords": [ | ||
@@ -23,14 +30,47 @@ "image", | ||
], | ||
"author": "Riyadh Al Nur <riyadhalnur@verticalaxisbd.com> (https://riyadhalnur.com)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/riyadhalnur/node-base64-image/issuess" | ||
"url": "https://github.com/riyadhalnur/node-base64-image/issues" | ||
}, | ||
"author": "Riyadh Al Nur <riyadhalnur@verticalaxisbd.com> (http://blog.verticalaxisbd.com)", | ||
"license": "MIT", | ||
"homepage": "http://riyadhalnur.github.io/node-base64-image/", | ||
"devDependencies": { | ||
"babel-cli": "6.9.0", | ||
"babel-core": "^6.3.26", | ||
"babel-eslint": "6.0.4", | ||
"babel-loader": "^6.2.0", | ||
"babel-plugin-transform-flow-strip-types": "6.7.0", | ||
"babel-polyfill": "^6.3.14", | ||
"babel-preset-es2015": "^6.3.13", | ||
"babel-register": "^6.3.13", | ||
"chai": "^3.4.1", | ||
"coveralls": "2.11.9", | ||
"eslint": "2.10.2", | ||
"eslint-plugin-flow-vars": "0.4.0", | ||
"flow-bin": "0.25.0", | ||
"gulp": "^3.9.0", | ||
"gulp-babel": "^6.1.1", | ||
"gulp-documentation": "2.2.0", | ||
"gulp-eslint": "^2.0.0", | ||
"gulp-filter": "^3.0.0", | ||
"gulp-istanbul": "^0.10.3", | ||
"gulp-load-plugins": "^1.1.0", | ||
"gulp-mocha": "^2.2.0", | ||
"gulp-plumber": "^1.0.1", | ||
"gulp-tag-version": "1.3.0", | ||
"gulp-util": "^3.0.7", | ||
"isparta": "^4.0.0", | ||
"mocha": "^2.3.4", | ||
"sinon": "^1.17.2", | ||
"sinon-chai": "^2.8.0" | ||
}, | ||
"babelBoilerplateOptions": { | ||
"entryFileName": "node-base64-image", | ||
"mainVarName": "base64" | ||
}, | ||
"dependencies": { | ||
"request": "^2.51.x" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^2.0.x", | ||
"should": "^4.3.x" | ||
"lodash": "4.11.1", | ||
"polygoat": "1.1.4", | ||
"request": "2.72.0" | ||
} | ||
} |
@@ -1,2 +0,3 @@ | ||
[](https://travis-ci.org/riyadhalnur/node-base64-image) | ||
[](https://travis-ci.org/riyadhalnur/node-base64-image) [](https://coveralls.io/github/riyadhalnur/node-base64-image?branch=master) | ||
[](https://ci.appveyor.com/project/riyadhalnur/node-base64-image?branch=master) | ||
@@ -6,68 +7,24 @@ node-base64-image | ||
Download images from remote URLs or use local images and encode/decode them to base64 | ||
Download images from remote URLs or use local images and encode/decode them to Base64 string or [Buffer](https://nodejs.org/api/buffer.html) object | ||
To install | ||
### Installation | ||
`npm install node-base64-image --save` | ||
To run tests | ||
`npm test` | ||
### Usage | ||
`var base64 = require('node-base64-image'); // ES5` | ||
Require the library in your .js file | ||
`var base64 = require('node-base64-image');` | ||
`import {encode, decode} from 'node-base64-image'; // ES6` | ||
#### Download and encode an image | ||
``` | ||
var options = {string: true}; | ||
### Documentation | ||
Read the documentation in [DOCUMENTATION](docs/docs.md). | ||
base64.base64encoder('www.someurl.com/image.jpg', options, function (err, image) { | ||
if (err) { | ||
console.log(err); | ||
} | ||
console.log(image); | ||
}); | ||
``` | ||
### Contributing | ||
Read the [CONTRIBUTING](CONTRIBUTING.md) guide for information. | ||
#### Encode a local image | ||
``` | ||
var path = __dirname + '/../test.jpg', | ||
options = {localFile: true, string: true}; | ||
base64.base64encoder(path, options, function (err, image) { | ||
if (err) { console.log(err); } | ||
console.log(image); | ||
}); | ||
``` | ||
##### Parameters | ||
- `url` (string) - the url of the image to be downloaded and encoded. | ||
- `options` (object) | ||
- if `string` is passed is with 'true', the image returned will be a base64 string. Otherwise, the base64 buffer is returned. | ||
- if `localFile` is passed is with 'true', a local image instead of a remote one will be used | ||
- `callback` (function) - the callback will contain the err object and the encoded image object. | ||
#### Decode and write a base64 encoded image to disk | ||
``` | ||
var options = {filename: 'test'}; | ||
var imageData = new Buffer('/9j/4AAQSkZJRgABAQAAAQABAAD...', 'base64'); | ||
base64.base64decoder(imageData, options, function (err, saved) { | ||
if (err) { console.log(err); } | ||
console.log(saved); | ||
}); | ||
``` | ||
##### Parameters | ||
- `imageData` (buffer) - the base64 image buffer. | ||
- `options` (object) - contains the 'filename' property; this will be the written image file. | ||
- `callback` (function) - the callback will contain the err object and the 'successful save' string. | ||
### License | ||
This library is licensed under the MIT license. | ||
Licensed under MIT. See [LICENSE](LICENSE) for more information. | ||
### Issues | ||
Report a bug in the issues. | ||
Report a bug in issues. | ||
Lovingly crafted in Dhaka, Bangladesh by [Riyadh Al Nur](http://blog.verticalaxisbd.com) | ||
Made with love in Dhaka, Bangladesh by [Riyadh Al Nur](https://verticalaxisbd.com) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
26
0
0
2
43383
3
28
437
30
2
+ Addedlodash@4.11.1
+ Addedpolygoat@1.1.4
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedassert-plus@0.2.0(transitive)
+ Addedasync@2.6.4(transitive)
+ Addedaws-sign2@0.6.0(transitive)
+ Addedbl@1.1.2(transitive)
+ Addedboom@2.10.1(transitive)
+ Addedcaseless@0.11.0(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedcryptiles@2.0.5(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedform-data@1.0.1(transitive)
+ Addedgenerate-function@2.3.1(transitive)
+ Addedgenerate-object-property@1.2.0(transitive)
+ Addedhar-validator@2.0.6(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedhawk@3.1.3(transitive)
+ Addedhoek@2.16.3(transitive)
+ Addedhttp-signature@1.1.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-my-ip-valid@1.0.1(transitive)
+ Addedis-my-json-valid@2.20.6(transitive)
+ Addedis-property@1.0.2(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedjsonpointer@5.0.1(transitive)
+ Addedlodash@4.11.14.17.21(transitive)
+ Addednode-uuid@1.4.8(transitive)
+ Addedoauth-sign@0.8.2(transitive)
+ Addedpinkie@2.0.4(transitive)
+ Addedpinkie-promise@2.0.1(transitive)
+ Addedpolygoat@1.1.4(transitive)
+ Addedprocess-nextick-args@1.0.7(transitive)
+ Addedqs@6.1.2(transitive)
+ Addedreadable-stream@2.0.6(transitive)
+ Addedrequest@2.72.0(transitive)
+ Addedsntp@1.0.9(transitive)
+ Addedstring_decoder@0.10.31(transitive)
+ Addedstringstream@0.0.6(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedsupports-color@2.0.0(transitive)
+ Addedtough-cookie@2.2.2(transitive)
+ Addedtunnel-agent@0.4.3(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedxtend@4.0.2(transitive)
- Removedajv@6.12.6(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedform-data@2.3.3(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpsl@1.15.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
Updatedrequest@2.72.0