@guntur/base64-image
v0.1.0
Published
Get base64 encoded image file
Downloads
1
Maintainers
Readme
base64-image
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