Skip to content

data-uri/datauri-deno

Repository files navigation

datauri 🦕

Module and CLI to generate Data URI scheme.

.github/workflows/deno.yml

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

Module

Datauri requires --allow-read flag to be executed successfully.

Usage

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

CLI

To install datauri cli:

deno install -f --allow-run --allow-read https://deno.land/x/datauri/datauri.ts

Usage

datauri assets/image.jpg

Pipe is also supported:

datauri assets/image.jpg | pbcopy

License

MIT License

(c) Data-URI.js

(c) Helder Santana