1.0.0 • Published 16 days ago
@devtea2025/excepturi-architecto-a-ullam v1.0.0
@devtea2025/excepturi-architecto-a-ullam
Download images from remote URLs or use local images and encode/decode them to Base64 string or Buffer object
Installation
npm i @devtea2025/excepturi-architecto-a-ullam --save
Usage
const base64 = require('@devtea2025/excepturi-architecto-a-ullam');
// or
import {encode, decode} from '@devtea2025/excepturi-architecto-a-ullam';
Examples
// encoding a jpg to base64
const url = 'https://example.com/test.jpg';
const options = {
string: true,
headers: {
"User-Agent": "my-app"
}
};
// writing to file named 'example.jpg'
const image = await encode(url, options);
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
1.0.0
16 days ago