r-dust

0.0.1 • Public • Published

"dust" is a "Data URL Scheme" Tool.

"dust" was designed for browser app,
specifically on nwjs. ( node.js(io.js) + browser component )

What is dus?

"dus" is "Data URL Scheme".
You can represent data in the URL.

format:

data:[mime];base64,[binary]

example :

[right click & copy link address ](#data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOAgMAAABiJsVCAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX/mWYAAAD//2bMzACyRM7sAA AAAXRSTlMAQObYZgAAAAFiS0dEAmYLfGQAAAAHdElNRQffCBECBCSsgoraAAAARUlEQVQI12NgAINABwYGxmUgYqajAwN71jUHBraslQwMbLuWAMVWTXVgYHwdDSJuAYlVsQwM7Fe/MDDITVzLwCAaGMoAAPkdEJQc4yGaAAAAJXRFWHRkYX RlOmNyZWF0ZQAyMDE1LTA4LTE3VDAyOjA0OjM2KzAwOjAwxuahVAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNS0wOC0xN1QwMjowNDozNiswMDowMLe7GegAAAAASUVORK5CYII=)

dus To easy

// example_1.js
var dust = require("dust");
var url = dust("./xxx.png").toDust();  // data:image/png;base64,(binary)

var img = new Image();
img.src = url;
document.body.appendChild(img);

dus to eco

binary caching,

Accumulate the binary data into memory, and then retrieve the data from there.

// example_2.js
var path = "./xxx.png";

var img_alpha = new Image();
img_alpha.src = dust(path).toDust();	// file read
document.body.appendChild(img_alpha);

var img_bravo = new Image();
img_bravo.src = dust(path).toDust();	// memory read
document.body.appendChild(img_bravo);

dus to easy delivar product

develop

# directory
./app.js
./resource_load.js
./img/a.png
./img/b.png
./img/c.png
// resource_load.js
var path_a = "./img/a.png";
var path_b = "./img/b.png";
var path_c = "./img/c.png";
// app.js
if (! debug) dust().load(./dust.bin); // first binary load
var alpha = dust(path_a).toDust();
var charlie = dust(path_c).toDust();

*** ※ "debug variable" please you are prepared ***

staging

# create "dust.bin" file
dust ./img dust.bin
# production env unuse raw files
rm -rf ./img

Readme

Keywords

none

Package Sidebar

Install

npm i r-dust

Weekly Downloads

1

Version

0.0.1

License

MIT

Last publish

Collaborators

  • mitts