You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

base64url

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.6 to 2.0.0-rc1

dist/.gitkeep

56

index.js

@@ -1,54 +0,2 @@

function fromBase64(base64string) {
return (
base64string
.replace(/=/g, '')
.replace(/\+/g, '-')
.replace(/\//g, '_')
);
}
function toBase64(base64UrlString) {
if (Buffer.isBuffer(base64UrlString))
base64UrlString = base64UrlString.toString();
var b64str = padString(base64UrlString)
.replace(/\-/g, '+')
.replace(/_/g, '/');
return b64str;
}
function padString(string) {
var segmentLength = 4;
var stringLength = string.length;
var diff = string.length % segmentLength;
if (!diff)
return string;
var position = stringLength;
var padLength = segmentLength - diff;
var paddedStringLength = stringLength + padLength;
var buffer = Buffer(paddedStringLength);
buffer.write(string);
while (padLength--)
buffer.write('=', position++);
return buffer.toString();
}
function decodeBase64Url(base64UrlString, encoding) {
return Buffer(toBase64(base64UrlString), 'base64').toString(encoding);
}
function base64url(stringOrBuffer, encoding) {
return fromBase64(Buffer(stringOrBuffer, encoding).toString('base64'));
}
function toBuffer(base64string) {
return Buffer(toBase64(base64string), 'base64');
}
base64url.toBase64 = toBase64;
base64url.fromBase64 = fromBase64;
base64url.decode = decodeBase64Url;
base64url.encode = base64url;
base64url.toBuffer = toBuffer;
module.exports = base64url;
module.exports = require('./dist/base64url').default;
module.exports.default = module.exports;
{
"name": "base64url",
"version": "1.0.6",
"version": "2.0.0-rc1",
"description": "For encoding to/from base64urls",
"main": "index.js",
"bin": {
"base64url": "./bin/base64url"
},
"typings": "dist/index.d.ts",
"files": [
"dist/",
"index.js"
],
"scripts": {
"test": "./node_modules/.bin/tap test/*.test.js"
"build": "tsc",
"clean": "rm -f dist/*",
"test": "tap test/*.test.js",
"prepublish": "npm run clean && npm run build && npm run test "
},

@@ -22,11 +27,6 @@ "repository": {

"license": "MIT",
"readmeFilename": "readme.md",
"gitHead": "a219306e93712cb4380286b44360fea4406d49d3",
"readmeFilename": "README.md",
"devDependencies": {
"tap": "~0.3.3"
},
"dependencies": {
"concat-stream": "~1.4.7",
"meow": "~2.0.0"
"tap": "6.1.1"
}
}

@@ -15,24 +15,4 @@ # base64url [![Build Status](https://secure.travis-ci.org/brianloveswords/base64url.png)](http://travis-ci.org/brianloveswords/base64url)

```bash
$ npm install -g base64url
The CLI has been removed. For the time being, please install `base64url@1.0.4` if you need the CLI.
$ echo 'Here is some text to encode' | base64url
> SGVyZSBpcyBzb21lIHRleHQgdG8gZW5jb2RlCg
$ echo SGVyZSBpcyBzb21lIHRleHQgdG8gZW5jb2RlCg | base64url -D
> Here is some text to encode
$ base64url --help
For encoding to/from base64urls
Usage: base64url [-hvD] [-b num] [-i in_file] [-o out_file]
-h, --help display this message
-v, --version display version info
-D, --decode decodes input
-b, --break break encoded string into num character lines
-i, --input input file (default: stdin)
-o, --output output file (default: stdout),
```
## Library

@@ -107,3 +87,3 @@

```
Copyright (c) 2014 Brian J. Brennan
Copyright (c) 2013–2016 Brian J. Brennan

@@ -110,0 +90,0 @@ Permission is hereby granted, free of charge, to any person obtaining a

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc