2.0.7 • Published 11 months ago
node-base64-image v2.0.7
node-base64-image
Download images from remote URLs or use local images and encode/decode them to Base64 string or Buffer object
Installation
npm i node-base64-image --save
Usage
const base64 = require('node-base64-image');
// or
import {encode, decode} from 'node-base64-image';
Examples
// encoding a remote jpg to base64
const url = 'https://example.com/test.jpg';
const options = {
string: true,
headers: {
"User-Agent": "my-app"
}
};
const image = await encode(url, options);
// encoding a local file
const localUrl = 'C:/project/test.jpg';
const localImage = await encode(url, {string: true, local: true});
// writing to file named 'example.jpg'
await decode(image, { fname: 'example', ext: 'jpg' });
// writing to a sub-directory
// after creating a directory called 'photos'
const image = await encode(url, options);
await decode(image, { fname: './photos/example', ext: 'jpg' });
Contributing
Read the CONTRIBUTING guide for information.
License
Licensed under MIT. See LICENSE for more information.
Issues
Report a bug in issues.
Made with love in Dhaka, Bangladesh by Riyadh Al Nur
2.0.7
11 months ago
2.0.6
2 years ago
2.0.5
2 years ago
2.0.4
3 years ago
2.0.3
4 years ago
2.0.2
4 years ago
2.0.1
5 years ago
2.0.0
5 years ago
1.0.7
5 years ago
1.0.6
6 years ago
1.0.5
7 years ago
1.0.4
8 years ago
1.0.3
9 years ago
1.0.1
9 years ago
1.0.0
9 years ago
0.1.2
9 years ago
0.1.1
10 years ago
0.1.0
10 years ago
0.0.1
11 years ago