@guntur/base64-image

0.1.0 • Public • Published

base64-image

Build Status npm node

Get base64 encoded image file


Install

$ npm install @guntur/base64-image

Usage

const base64Image = require('@guntur/base64-image');

const imgPath = '/path/to/image.png';

base64Image.encoder(imgPath).then(base64String => {
    console.log(base64String);
    //=> 'data:image/png;base64,iVBORw0KGgoAAA...TkSuQmCC'
});

console.log(base64Image.encoder.sync(imgPath));
//=> 'data:image/png;base64,iVBORw0KGgoAAA...TkSuQmCC'

API

base64Image.encoder(filepath)

  • Params:
    • filepath: <string> - (required)
  • Returns: Promise<string>

base64Image.encoder.sync(filepath)

  • Params:
    • filepath: <string> - (required)
  • Returns: <string>

License

MIT © Guntur Poetra

Package Sidebar

Install

npm i @guntur/base64-image

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

3.65 kB

Total Files

4

Last publish

Collaborators

  • guntur