url-base64
v1.3.4
Published
Base64 variant. Can be used without escaping in file names, URL path components/query strings.
Downloads
160
Readme
Usage
const urlBase64 = require('url-base64');
let buffer = urlBase64.parseUrlBase64('dXJsLWJhc2U2NA');
let base64Str = urlBase64.convertToUrlBase64(buffer);
url-base64
URL-base64 allows this base-64 variant to be used in URL path components/filenames, as well as query string values.
The Base-64 mapping is the same except '+' is replaced with '-', and '/' is replaced with '_'.
Trailing '=' characters are also omitted. It is assumed that the output buffer will be an integer number of bytes. Since each Base64 digit represents 6 bits, any dangling bits are set to 0 when encoding, and discarded when decoding. It is an error to have non-zero dangling bits.
More info at https://www.armdock.com/url-base64