Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Convert from normal to web-safe, strip trailing "="s
- function webSafe64(base64) {
- return base64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
- }
- // Convert from web-safe to normal, add trailing "="s
- function normal64(base64) {
- return base64.replace(/\-/g, '+').replace(/_/g, '/') + '=='.substring(0, (3*base64.length)%4);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement