Comparing version 1.0.6 to 2.0.0-rc1
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 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
0
5489
8
68
2
107
- Removedconcat-stream@~1.4.7
- Removedmeow@~2.0.0
- Removedcamelcase@1.2.1(transitive)
- Removedcamelcase-keys@1.0.0(transitive)
- Removedconcat-stream@1.4.11(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedget-stdin@4.0.1(transitive)
- Removedindent-string@1.2.2(transitive)
- Removedinherits@2.0.4(transitive)
- Removedis-finite@1.1.0(transitive)
- Removedisarray@0.0.1(transitive)
- Removedmap-obj@1.0.1(transitive)
- Removedmeow@2.0.0(transitive)
- Removedminimist@1.2.8(transitive)
- Removedobject-assign@1.0.0(transitive)
- Removedreadable-stream@1.1.14(transitive)
- Removedrepeating@1.1.3(transitive)
- Removedstring_decoder@0.10.31(transitive)
- Removedtypedarray@0.0.7(transitive)