diff options
author | Minteck <contact@minteck.org> | 2021-12-21 16:50:49 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2021-12-21 16:50:49 +0100 |
commit | 20204baf1807825af4798ad03bfb329e4da05bc5 (patch) | |
tree | 1568515fa1e4592206ed5d2327b39e6b443cbd03 /node_modules/utile/lib/base64.js | |
download | bingoloto-remote-20204baf1807825af4798ad03bfb329e4da05bc5.tar.gz bingoloto-remote-20204baf1807825af4798ad03bfb329e4da05bc5.tar.bz2 bingoloto-remote-20204baf1807825af4798ad03bfb329e4da05bc5.zip |
Commit
Diffstat (limited to 'node_modules/utile/lib/base64.js')
-rw-r--r-- | node_modules/utile/lib/base64.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/node_modules/utile/lib/base64.js b/node_modules/utile/lib/base64.js new file mode 100644 index 0000000..c52e356 --- /dev/null +++ b/node_modules/utile/lib/base64.js @@ -0,0 +1,44 @@ +/* + * base64.js: An extremely simple implementation of base64 encoding / decoding using node.js Buffers + * + * (C) 2010, Charlie Robbins & the Contributors. + * + */ + +var base64 = exports; + +// +// ### function encode (unencoded) +// #### @unencoded {string} The string to base64 encode +// Encodes the specified string to base64 using node.js Buffers. +// +base64.encode = function (unencoded) { + var encoded; + + try { + encoded = new Buffer(unencoded || '').toString('base64'); + } + catch (ex) { + return null; + } + + return encoded; +}; + +// +// ### function decode (encoded) +// #### @encoded {string} The string to base64 decode +// Decodes the specified string from base64 using node.js Buffers. +// +base64.decode = function (encoded) { + var decoded; + + try { + decoded = new Buffer(encoded || '', 'base64').toString('utf8'); + } + catch (ex) { + return null; + } + + return decoded; +}; |