Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Node.js module for Data URI applications. It performs conversions between Node.js Buffers and RFC2397-compliant Data URIs, or vice versa.
This Node.js module for Data URI applications is called Dauria (after a part of Transbaikal).
Dauria performs conversions between Node.js Buffers and RFC2397-compliant Data URIs, or vice versa.
Dauria is written in JavaScript and requires Node.js to run.
Buffer.from
method.Dauria is tested against Node.js v5, Node.js v6, Node.js v7 and the latest stable version of Node.js.
Latest packaged version: npm install dauria
Latest githubbed version: npm install https://github.com/Mithgol/dauria/tarball/master
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.)
When you require()
the installed module, you get an object that has the following methods:
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.
Example:
Parses the given Data URI and returns an object with the following properties:
MIME
— MIME content type in the form type/subtype
as explained in RFC2045 Section 5.2. If not given in the URI, MIME
becomes 'text/plain'
by default (as recommended by RFC2397 in section 2).
mediaType
— MIME content type with the semicolon-separated list of parameters (if any) in the form parameter=value
(some values may appear urlencoded, and Dauria does not decode them). If not given in the URI, mediaType
becomes 'text/plain;charset=US-ASCII'
by default (as recommended by RFC2397 in section 2).
buffer
— Node.js Buffer containing the data decoded from the given Data URI. Hexadecimal URL encoding (such as '%20'
for a whitespace) and base64 encoding are both supported (the latter must be indicated by the string ';base64'
before the first comma in the given Data URI).
charset
— the value of the first 'charset=...'
parameter encountered in mediaType
. If mediaType
does not contain any charset parameters, charset
becomes 'US-ASCII'
. However, if MIME
does not start with 'text/'
, then charset
becomes null
regardless of any parameters.
text
— a JavaScript string containing the text decoded from buffer
using charset
. However, if MIME
does not start with 'text/'
, then text
becomes null
. It also becomes null
if the iconv-lite module does not know the encountered charset
.
If the given dataURI
is not in fact a Data URI (does not start with 'data:'
or does not contain a comma), an error is thrown.
Example:
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).
MIT license (see the LICENSE
file), with the following exceptions:
The file test/red-dot-5px.png
is taken from Wikipedia where it has been released into the public domain by Johan Elisson.
The file test/larry.gif
is decoded from RFC2397 where it was given as an example. (RFC2397's Full Copyright Statement permits publishing and distribution of derivative works that assist in its implementation.)
FAQs
Node.js module for Data URI applications. It performs conversions between Node.js Buffers and RFC2397-compliant Data URIs, or vice versa.
We found that dauria demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.