@rossbob/image-to-base64
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

imageToBase64

Encode Media from uri or file to base64 on Node.js

Installation

$ npm install @rossbob/image-to-base64

Unit Test

  • Jest
  • Coverage : 100%

Usage

toBase64(image: Media): Promise

interface Media {
  path?: string,
  uri?: string,
}
import { toBase64 } from "@rossbob/image-to-base64";

async function main() {
  const imageBase64WithFile = await toBase64({ path: "./hdm-panda-chine.jpg" });

  const imageBase64WithURI = await toBase64({ uri: "https://www.ecosia.org/images?q=panda#id=9E3AE73E84FAAFFC7DD4D3725F33ADFD2346CA77" })
}

main().catch(console.error);

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.0.15latest

Version History

VersionDownloads (Last 7 Days)Published
3.0.15
3.0.01
2.0.07
1.0.41
1.0.30
1.0.21
1.0.11
1.0.00

Package Sidebar

Install

npm i @rossbob/image-to-base64

Weekly Downloads

16

Version

3.0.1

License

MIT

Unpacked Size

3 MB

Total Files

31

Last publish

Collaborators

  • rossbob