Binary safe implementation of RFC 3548 Base32 encoding/decoding for node.
npm install rfc-3548-b32Implementation of [RFC-3548] Base32 encoding/decoding for node that uses [Buffers] for input/output so it's binary safe.
var base32 = require('rfc-3548-b32');
// Arbitrary binary data:
var bytes = new Buffer([1, 2, 3, 4, 5]);
// bytes (hex): 0102030405
console.log("bytes (hex): %s", bytes.toString('hex'));
// Encode it as base32 string:
var bytesAsBase32 = base32.encode(bytes);
// bytes (b32): AEBAGBAF
console.log("bytes (b32): %s", bytesAsBase32);
// Decode it back to a buffer:
var decodedBytes = base32.decode(bytesAsBase32);
// bytes (hex): 0102030405
console.log("bytes (hex): %s", decodedBytes.toString('hex'));
$ make test
[RFC-3548]: http://tools.ietf.org/html/rfc3548
[Buffers]: http://nodejs.org/api/buffer.html