This Node.js module for Data URI applications is called Dauria (after a part of Transbaikal).
It performs conversions between Node.js Buffers and RFC2397-compliant Data URIs.
Installing Dauria
The npm package does not contain the tests, they're published on GitHub only.
You may visit https://github.com/Mithgol/dauria#readme occasionally to read the latest README
because the package's version is not planned to grow after changes when they happen in README
only. (And npm publish --force
is forbidden nowadays.)
Using Dauria
When you require()
the installed module, you get an object that has the following method:
getBase64DataURI(sourceBuffer, MIME)
Returns a string containing the data:...
URI that represent the given source Buffer in the base64-encoded form.
An optional second parameter (MIME
) suggests the MIME type of the given Buffer. If the parameter is not given, 'application/octet-stream'
is used.
Testing Dauria
The tests are not included in the npm package of the module (to keep it small). Use the version from GitHub.
It is necessary to install Mocha and JSHint for testing.
-
You may install Mocha globally (npm install mocha -g
) or locally (npm install mocha
in the directory of Dauria).
-
You may install JSHint globally (npm install jshint -g
) or locally (npm install jshint
in the directory of Dauria).
After that you may run npm test
(in the directory of Dauria).
License
MIT license (see the LICENSE
file), with the following exception: