Module and CLI to generate Data URI scheme.
The data URI scheme is a uniform resource identifier (URI) scheme that provides a way to include data in-line in web pages as if they were external resources.
from: Wikipedia
Datauri requires --allow-read
flag to be executed successfully.
import { datauri } from "https://deno.land/x/datauri/mod.ts";
const helloWorld = await datauri("assets/image.gif");
console.log(helloWorld); // data:image/gif,base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
To install datauri cli:
deno install -f --allow-run --allow-read https://deno.land/x/datauri/datauri.ts
datauri assets/image.jpg
Pipe is also supported:
datauri assets/image.jpg | pbcopy
MIT License
(c) Data-URI.js
(c) Helder Santana