@builderbot-plugins/url-to-base64
v1.0.0
Published
Download any url to base64
Downloads
56
Readme
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)