1.0.0 • Published 1 year ago

@builderbot-plugins/url-to-base64 v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Convert paths or urls to base64 file

Usage

import { UrlBase64 } from "@builderbot-plugins/url-to-base64"


const { mimetype, data } = await UrlBase64.fromUrl(url)


console.log(mimetype, data)

/*
mimetype is an image/jpg | application/pdf or any mimetype format

data is a base64 raw

data:${mimetype};base64,${data}
*/


// Other way for make the same

// filePath is './image.jpg' or any route in your local file system

const { mimetype, data } = await UrlBase64.fromFilePath(url)


console.log(mimetype, data)
1.0.0

1 year ago