b64
Installation:

npm: npm install @hapi/b64

yarn: yarn add @hapi/b64

encode(buffer)

Base64 encode the buffer and return it as a new Buffer.

decode(buffer)

Base64 decode the buffer and return the result as a new buffer.

Encoder

Transform stream that base64 encodes each chunk of the stream.

Example:

'use strict';

const Fs = require('fs');
const B64 = require('@hapi/b64');

const stream = Fs.createReadStream(`${__dirname}/package.json`);
const encoder = new B64.Encoder();

stream.pipe(encoder).pipe(process.stdout);

Decoder

Transform stream that base64 decodes each chunk of the stream.

Example:

'use strict';

const Fs = require('fs');
const B64 = require('@hapi/b64');

const stream = Fs.createReadStream(`${__dirname}/encodedfile.b64`);
const decoder = new B64.Decoder();

stream.pipe(decoder).pipe(process.stdout);

base64urlEncode(value)

Encodes value of string or buffer type in Base64 or URL encoding, function will assert input value is correct.

base64urlDecode(value)

Decodes string into Base64 or URL encoding, function throws an error on invalid input and returns a string or buffer depending on encoding provided. Default encoding is binary.

Changelog

#26
Update deps
#25
Change module namespace
#22
Remove engines
#21
Update hoek v6
#20
Move base64 methods from hoek
4.0.0
breaking changes
#18
Node 8
#24
Commercial version of v3 branch
#17
3.0.3 Release notes
#16
Remove deprecated buffer usage
#15
Pending deprecation for new Buffer()
#14
Update deps
#13
Document API
#12
Separate decode/encode modules
#10
Document API
#11
update hoek to 4.x.x
#9
Update lab and travis node version
3.0.0
breaking changes
#8
es6. Closes #7
#7
ES6 style, node v4
#5
Update to Lab 5.x.x and Code 1.x.x
#4
Update .travis.yml
clipboard