How to use the base62.decode function in base62

To help you get started, we’ve selected a few base62 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github d4l3k / WebSync / lib / routes.js View on Github external
function wsConnection(ws) {
  console.log('Connection: ', ws.upgradeReq.url);
  var url = ws.upgradeReq.url;
  var base = url.split('?')[0];
  var parts = base.split('/');
  console.log(parts);
  // strip off websockets/ from the path
  parts.shift();
  ws.docId = Base62.decode(parts[1]);
  if (parts[2] !== 'edit' && parts[2] !== 'view') {
    return;
  }

  // Helper Functions
  ws.sendJSON = function(json) {
    this.send(JSON.stringify(json), function(err) {
      if (err) {
        console.error('WS ERROR', err);
      }
    });
  };
  ws.error = function(msg) {
    ws.sendJSON({
      type: 'error',
      reason: msg

base62

JavaScript Base62 encode/decoder

MIT
Latest version published 7 months ago

Package Health Score

80 / 100
Full package analysis