UNPKG

fast-base64

Version:

Fastest possible base64 encoding/decoding using WebAssembly

13 lines (10 loc) 261 B
export {fromUrl, toUrl}; function fromUrl(url) { return ( url.replace(/-/g, '+').replace(/_/g, '/') + '===='.slice(0, (4 - (url.length % 4)) % 4) ); } function toUrl(url) { return url.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, ''); }