tsoa
This commit is contained in:
11
node_modules/@hapi/b64/LICENSE.md
generated
vendored
Executable file
11
node_modules/@hapi/b64/LICENSE.md
generated
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
Copyright (c) 2014-2022, Project contributors
|
||||
Copyright (c) 2014-2020, Sideway Inc
|
||||
Copyright (c) 2014, Walmart.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* The names of any contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS OFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
17
node_modules/@hapi/b64/README.md
generated
vendored
Normal file
17
node_modules/@hapi/b64/README.md
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<a href="https://hapi.dev"><img src="https://raw.githubusercontent.com/hapijs/assets/master/images/family.png" width="180px" align="right" /></a>
|
||||
|
||||
# @hapi/b64
|
||||
|
||||
#### Base64 streaming encoder and decoder.
|
||||
|
||||
**b64** is part of the **hapi** ecosystem and was designed to work seamlessly with the [hapi web framework](https://hapi.dev) and its other components (but works great on its own or with other frameworks). If you are using a different web framework and find this module useful, check out [hapi](https://hapi.dev) – they work even better together.
|
||||
|
||||
### Visit the [hapi.dev](https://hapi.dev) Developer Portal for tutorials, documentation, and support
|
||||
|
||||
## Useful resources
|
||||
|
||||
- [Documentation and API](https://hapi.dev/family/b64/)
|
||||
- [Versions status](https://hapi.dev/resources/status/#b64) (builds, dependencies, node versions, licenses, eol)
|
||||
- [Changelog](https://hapi.dev/family/b64/changelog/)
|
||||
- [Project policies](https://hapi.dev/policies/)
|
||||
- [Free and commercial support options](https://hapi.dev/support/)
|
||||
126
node_modules/@hapi/b64/lib/decoder.js
generated
vendored
Executable file
126
node_modules/@hapi/b64/lib/decoder.js
generated
vendored
Executable file
@@ -0,0 +1,126 @@
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
Decode functions adapted from:
|
||||
Version 1.0 12/25/99 Copyright (C) 1999 Masanao Izumo <iz@onicos.co.jp>
|
||||
http://www.onicos.com/staff/iz/amuse/javascript/expert/base64.txt
|
||||
*/
|
||||
|
||||
const Stream = require('stream');
|
||||
|
||||
|
||||
const internals = {
|
||||
decodeChars: [
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
|
||||
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
|
||||
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
|
||||
-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
||||
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
exports.decode = function (buffer) {
|
||||
|
||||
const decodeChars = internals.decodeChars;
|
||||
const len = buffer.length;
|
||||
const allocated = Math.ceil(len / 4) * 3;
|
||||
const result = Buffer.alloc(allocated);
|
||||
|
||||
let c1;
|
||||
let c2;
|
||||
let c3;
|
||||
let c4;
|
||||
let j = 0;
|
||||
|
||||
for (let i = 0; i < len; ) {
|
||||
do {
|
||||
c1 = decodeChars[buffer[i++] & 0xff];
|
||||
}
|
||||
while (i < len && c1 === -1);
|
||||
|
||||
if (c1 === -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
do {
|
||||
c2 = decodeChars[buffer[i++] & 0xff];
|
||||
}
|
||||
while (i < len && c2 === -1);
|
||||
|
||||
if (c2 === -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
result[j++] = (c1 << 2) | ((c2 & 0x30) >> 4);
|
||||
|
||||
do {
|
||||
c3 = buffer[i++] & 0xff;
|
||||
if (c3 === 61) { // =
|
||||
return result.slice(0, j);
|
||||
}
|
||||
|
||||
c3 = decodeChars[c3];
|
||||
}
|
||||
while (i < len && c3 === -1);
|
||||
|
||||
if (c3 === -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
result[j++] = ((c2 & 0x0f) << 4) | ((c3 & 0x3c) >> 2);
|
||||
|
||||
do {
|
||||
c4 = buffer[i++] & 0xff;
|
||||
if (c4 === 61) { // =
|
||||
return result.slice(0, j);
|
||||
}
|
||||
|
||||
c4 = decodeChars[c4];
|
||||
}
|
||||
while (i < len && c4 === -1);
|
||||
|
||||
if (c4 !== -1) {
|
||||
result[j++] = ((c3 & 0x03) << 6) | c4;
|
||||
}
|
||||
}
|
||||
|
||||
return (j === allocated ? result : result.slice(0, j));
|
||||
};
|
||||
|
||||
|
||||
exports.Decoder = class Decoder extends Stream.Transform {
|
||||
constructor() {
|
||||
|
||||
super();
|
||||
this._reminder = null;
|
||||
}
|
||||
|
||||
_transform(chunk, encoding, callback) {
|
||||
|
||||
let part = this._reminder ? Buffer.concat([this._reminder, chunk]) : chunk;
|
||||
const remaining = part.length % 4;
|
||||
if (remaining) {
|
||||
this._reminder = part.slice(part.length - remaining);
|
||||
part = part.slice(0, part.length - remaining);
|
||||
}
|
||||
else {
|
||||
this._reminder = null;
|
||||
}
|
||||
|
||||
this.push(exports.decode(part));
|
||||
return callback();
|
||||
}
|
||||
|
||||
_flush(callback) {
|
||||
|
||||
if (this._reminder) {
|
||||
this.push(exports.decode(this._reminder));
|
||||
}
|
||||
|
||||
return callback();
|
||||
}
|
||||
};
|
||||
52
node_modules/@hapi/b64/lib/encoder.js
generated
vendored
Executable file
52
node_modules/@hapi/b64/lib/encoder.js
generated
vendored
Executable file
@@ -0,0 +1,52 @@
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
Encode functions adapted from:
|
||||
Version 1.0 12/25/99 Copyright (C) 1999 Masanao Izumo <iz@onicos.co.jp>
|
||||
http://www.onicos.com/staff/iz/amuse/javascript/expert/base64.txt
|
||||
*/
|
||||
|
||||
const Stream = require('stream');
|
||||
|
||||
|
||||
const internals = {};
|
||||
|
||||
|
||||
exports.encode = function (buffer) {
|
||||
|
||||
return Buffer.from(buffer.toString('base64'));
|
||||
};
|
||||
|
||||
|
||||
exports.Encoder = class Encoder extends Stream.Transform {
|
||||
constructor() {
|
||||
|
||||
super();
|
||||
this._reminder = null;
|
||||
}
|
||||
|
||||
_transform(chunk, encoding, callback) {
|
||||
|
||||
let part = this._reminder ? Buffer.concat([this._reminder, chunk]) : chunk;
|
||||
const remaining = part.length % 3;
|
||||
if (remaining) {
|
||||
this._reminder = part.slice(part.length - remaining);
|
||||
part = part.slice(0, part.length - remaining);
|
||||
}
|
||||
else {
|
||||
this._reminder = null;
|
||||
}
|
||||
|
||||
this.push(exports.encode(part));
|
||||
return callback();
|
||||
}
|
||||
|
||||
_flush(callback) {
|
||||
|
||||
if (this._reminder) {
|
||||
this.push(exports.encode(this._reminder));
|
||||
}
|
||||
|
||||
return callback();
|
||||
}
|
||||
};
|
||||
44
node_modules/@hapi/b64/lib/index.js
generated
vendored
Executable file
44
node_modules/@hapi/b64/lib/index.js
generated
vendored
Executable file
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
const Hoek = require('@hapi/hoek');
|
||||
|
||||
const Decoder = require('./decoder');
|
||||
const Encoder = require('./encoder');
|
||||
|
||||
|
||||
exports.decode = Decoder.decode;
|
||||
|
||||
exports.encode = Encoder.encode;
|
||||
|
||||
exports.Decoder = Decoder.Decoder;
|
||||
|
||||
exports.Encoder = Encoder.Encoder;
|
||||
|
||||
|
||||
// Base64url (RFC 4648) encode
|
||||
|
||||
exports.base64urlEncode = function (value, encoding) {
|
||||
|
||||
Hoek.assert(typeof value === 'string' || Buffer.isBuffer(value), 'value must be string or buffer');
|
||||
const buf = (Buffer.isBuffer(value) ? value : Buffer.from(value, encoding || 'binary'));
|
||||
return buf.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/\=/g, '');
|
||||
};
|
||||
|
||||
|
||||
// Base64url (RFC 4648) decode
|
||||
|
||||
exports.base64urlDecode = function (value, encoding) {
|
||||
|
||||
if (typeof value !== 'string') {
|
||||
|
||||
throw new Error('Value not a string');
|
||||
}
|
||||
|
||||
if (!/^[\w\-]*$/.test(value)) {
|
||||
|
||||
throw new Error('Invalid character');
|
||||
}
|
||||
|
||||
const buf = Buffer.from(value, 'base64');
|
||||
return (encoding === 'buffer' ? buf : buf.toString(encoding || 'binary'));
|
||||
};
|
||||
36
node_modules/@hapi/b64/package.json
generated
vendored
Normal file
36
node_modules/@hapi/b64/package.json
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "@hapi/b64",
|
||||
"description": "Base64 streaming encoder and decoder",
|
||||
"version": "6.0.1",
|
||||
"repository": "git://github.com/hapijs/b64",
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"keywords": [
|
||||
"buffer",
|
||||
"base64",
|
||||
"decode",
|
||||
"encode",
|
||||
"stream"
|
||||
],
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"plugin:@hapi/module"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@hapi/hoek": "^11.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@hapi/code": "^9.0.0",
|
||||
"@hapi/eslint-plugin": "*",
|
||||
"@hapi/lab": "^25.0.1",
|
||||
"@hapi/wreck": "^18.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "lab -a @hapi/code -t 100 -L",
|
||||
"test-cov-html": "lab -a @hapi/code -r html -o coverage.html"
|
||||
},
|
||||
"license": "BSD-3-Clause"
|
||||
}
|
||||
Reference in New Issue
Block a user