New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

base85

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

base85

Base85 (Ascii85) encode and decode functionality

  • 0.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.7K
decreased by-12.57%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

base85

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 (ASCII 33 '!' to ASCII 117 'u'), it contains quotes, both ' and " and other characters which might appear problematic in some applications.

Installation

npm install base85

Usage

For encoding:

var base85 = require('base85');
console.log(base85.encode('Hello, world!'));

Output: <~87cURD_*#TDfTZ)+T~>

For decoding:

var base85 = require('base85');
var decoded = base85.decode('<~@;Ka&GAhM;+CT.u+Du*?E,8s.+DkP&ATJu/@:O\'q@3B*\'Cht5\'Dg;~>');
console.log(decoded.toString('ascii'));

Output: all work and no play makes jack a dull boy

Bugs

Doesn't support the z-abbreviation as for now.

API

encode(data)

Encodes the specified data. The encoded data will be prepended with <~ and appended with ~>. This is actually following Adobes version which seems to be the common practice for base85.

data The data to encode, may be a String or a Buffer.

returns A String with the encoded data.

decode(data)

Decodes the specified data. 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 ~>.

returns A Buffer With the decoded data.

Keywords

FAQs

Package last updated on 21 Feb 2014

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc