New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-base64-image

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-base64-image - npm Package Compare versions

Comparing version 0.1.2 to 1.0.0

.babelrc

70

package.json
{
"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 @@

[![Build Status](https://travis-ci.org/riyadhalnur/node-base64-image.svg?branch=master)](https://travis-ci.org/riyadhalnur/node-base64-image)
[![Build Status](https://travis-ci.org/riyadhalnur/node-base64-image.svg?branch=master)](https://travis-ci.org/riyadhalnur/node-base64-image) [![Coverage Status](https://coveralls.io/repos/github/riyadhalnur/node-base64-image/badge.svg?branch=master)](https://coveralls.io/github/riyadhalnur/node-base64-image?branch=master)
[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/github/riyadhalnur/node-base64-image?branch=master&svg=true)](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

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