Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Simple utility to manage base85. Where base64 adds approximately 1/3,
base85 only adds about 1/4. Of course there's a tradeoff. The Base85
alphabet includes characters that might not be as friendly as the base64 alphabet.
While it's still only printable characters, the Ascii85 specification contains
quotes ('
and "
) which needs escaping in many programming languages,
and the ZeroMQ specification contains <
and >
which need escaping
in most (all?) SGML languages.
Supported encoding specifications
npm install base85
For encoding:
var base85 = require('base85');
console.log(base85.encode('Hello, world!')); // 'nm=QNz.92Pz/PV8aP'
console.log(base85.encode('Hello, world!', 'ascii85')); // ' <~87cURD_*#TDfTZ)+T~>'
For decoding:
var base85 = require('base85');
var decoded = base85.decode('vqG:5Cw?IqayPd#az#9uAbn%daz>L5wPF#evpK6}vix96y?$k6z*q');
console.log(decoded.toString('utf8')); // 'all work and no play makes jack a dull boy'
Doesn't support the z-abbreviation for Ascii85. This means that data encoded with this
support will cause the library to return false. An all-zero input buffer will be encoded
as <~!!!!!~>
, rather than <~z~>
Doesn't support IPv6 encoding specification (RFC1924) for now. This baby requires requires 128-bit arithmetic, which is rather problematic. I'm thrilled to see that the author of the RFC took this in consideration, specifically - quote from the RFC: "This is not considered a serious drawback in the representation, but a flaw of the processor designs." Silly processor designers.
encode(data[, encoding])
Encodes the specified data. If encoding is
ascii85
, the encoded data will be prepended with<~
and appended with~>
.data The data to encode, may be a
String
or a Buffer.encoding Which specification to use when encoding
data
. May be eitherascii85
(Adobe) orz85
(ZeroMQ). Default isz85
.returns A
String
with the encoded data.
decode(data[, encoding])
Decodes the specified data. If encoding is
ascii85
, the data is expected to start with<~
and and end with~>
. No checks are actually made for this, but output will be unexpected if this is not the case.A buffer is always returned as data may not be representable in a string. If you know it is, you can easily convert it to a string using the Buffer.toString() utility.
data The data to decode. May be a
String
or a Buffer. Expected to be enclosed in<~
and~>
.encoding Which specification
data
is encoded with. May be eitherascii85
(Adobe) orz85
(ZeroMQ). Default isz85
.returns A Buffer With the decoded data, or boolean
false
if the buffer could not be decoded. When testing if the result succeeded, always use operators with 3 characters ('===' or '!==').
FAQs
Base85 (Ascii85) encode and decode functionality
The npm package base85 receives a total of 1,838 weekly downloads. As such, base85 popularity was classified as popular.
We found that base85 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.