node-base64-image
TypeScript icon, indicating that this package has built-in type declarations

2.0.6 • Public • Published

Node.js Package

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 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

/node-base64-image/

    Package Sidebar

    Install

    npm i node-base64-image

    Weekly Downloads

    6,509

    Version

    2.0.6

    License

    MIT

    Unpacked Size

    24.4 kB

    Total Files

    12

    Last publish

    Collaborators

    • riyadhalnur