Skip to content

Instantly share code, notes, and snippets.

@NatashaKSS
Last active June 21, 2017 09:39
Show Gist options
  • Save NatashaKSS/c8be0e8906f976ca36394f9447190486 to your computer and use it in GitHub Desktop.
Save NatashaKSS/c8be0e8906f976ca36394f9447190486 to your computer and use it in GitHub Desktop.
Base64_Encode_Decode created by NatashaKSS - https://repl.it/Iulp/16
var BASE64_URL = require('base64url');
/**
* Sometimes, you need a way to quickly decode Base-64 formatted URLs into a human-editable format.
*
* Here's a short script that decodes base64 URLs and prints the decoded result onto the console.
*/
// Step 1: Enter your base URL here. E.g. it can be "https://localhost:3000" or "http://www.mysite.com"
var baseURL = ""; //TO EDIT
// Step 2: Copy & paste the base64 encoded query params located at the back of your URL (after the first '?')
var query = ""; // TO EDIT
console.log("=== The Decoded Query ===")
console.log(BASE64_URL.decode(query));
// Step 3: Copy & paste what was printed in the decoded query here & change the params to whatever you want
var queryToEncode = ""; // TO EDIT
console.log("\n\n=== The Re-encoded URL ===")
console.log(baseURL + "?" + BASE64_URL.encode(queryToEncode));
// Step 4: Copy the encoded URL from the console. DONE!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment