Intial Commit

This commit is contained in:
valki
2020-10-17 18:42:50 +02:00
commit 664c6d8ca3
5892 changed files with 759183 additions and 0 deletions

11
nodered/rootfs/data/node_modules/libbase64/.eslintrc generated vendored Normal file
View File

@@ -0,0 +1,11 @@
{
"rules": {
"indent": 0,
"global-require": 0,
"no-await-in-loop": 0
},
"extends": ["nodemailer", "prettier"],
"parserOptions": {
"ecmaVersion": 2017
}
}

View File

@@ -0,0 +1,5 @@
module.exports = {
printWidth: 160,
tabWidth: 4,
singleQuote: true
};

19
nodered/rootfs/data/node_modules/libbase64/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,19 @@
Copyright (c) 2014-2017 Andris Reinman
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

113
nodered/rootfs/data/node_modules/libbase64/README.md generated vendored Normal file
View File

@@ -0,0 +1,113 @@
# libbase64
Encode and decode base64 strings.
## Usage
Install with npm
npm install libbase64
Require in your script
```javascript
const libbase64 = require('libbase64');
```
### Encode values
Encode Buffer objects or unicode strings with
libbase64.encode(val) → String
Where
- **val** is a Buffer or an unicode string
**Example**
```javascript
libbase64.encode('jõgeva');
// asO1Z2V2YQ==
```
### Wrap encoded values
To enforce soft line breaks on lines longer than selected amount of characters, use `wrap`
libbase64.wrap(str[, lineLength]) → String
Where
- **str** is a base64 encoded string
- **lineLength** (defaults to 76) is the maximum allowed line length
**Example**
```javascript
libbase64.wrap('asO1Z2V2asO1Z2V2asO1Z2V2YQ==', 10);
// asO1Z2V2as\r\n
// O1Z2V2asO1\r\n
// Z2V2YQ==
```
### Transform Streams
`libbase64` makes it possible to encode and decode streams with `libbase64.Encoder` and `libbase64.Decoder` constructors.
### Encoder Stream
Create new Encoder Stream with
const encoder = new libbase64.Encoder([options])
Where
- **options** is the optional stream options object
- **options.lineLength** (Number) if you want to use any other line length than the default 76
characters (or set to `false` to turn the soft wrapping off completely)
- **options.skipStartBytes** (Number) Optional. How many bytes to skip from output (default to 0)
- **options.limitOutbutBytes** (Number) Optional. How many bytes to return (defaults to all bytes)
- **options.startPadding** (String) Optional. Fills first line with provided padding string. Usually goes together with skipStartBytes to get line folding correct.
**Example**
The following example script reads in a file, encodes it to base64 and saves the output to a file.
```javascript
const libbase64 = require('libbase64');
const fs = require('fs');
const source = fs.createReadStream('source.txt');
const encoded = fs.createReadStream('encoded.txt');
const encoder = new libbase64.Encoder();
source.pipe(encoder).pipe(encoded);
```
### Decoder Stream
Create new Decoder Stream with
const decoder = new libbase64.Decoder([options])
Where
- **options** is the optional stream options object
**Example**
The following example script reads in a file in base64 encoding, decodes it and saves the output to a file.
```javascript
const libbase64 = require('libbase64');
const fs = require('fs');
const encoded = fs.createReadStream('encoded.txt');
const dest = fs.createReadStream('dest.txt');
const decoder = new libbase64.Decoder();
encoded.pipe(decoder).pipe(dest);
```
## License
**MIT**

View File

@@ -0,0 +1,252 @@
'use strict';
const stream = require('stream');
const Transform = stream.Transform;
/**
* Encodes a Buffer into a base64 encoded string
*
* @param {Buffer} buffer Buffer to convert
* @returns {String} base64 encoded string
*/
function encode(buffer) {
if (typeof buffer === 'string') {
buffer = Buffer.from(buffer, 'utf-8');
}
return buffer.toString('base64');
}
/**
* Decodes a base64 encoded string to a Buffer object
*
* @param {String} str base64 encoded string
* @returns {Buffer} Decoded value
*/
function decode(str) {
str = str || '';
return Buffer.from(str, 'base64');
}
/**
* Adds soft line breaks to a base64 string
*
* @param {String} str base64 encoded string that might need line wrapping
* @param {Number} [lineLength=76] Maximum allowed length for a line
* @returns {String} Soft-wrapped base64 encoded string
*/
function wrap(str, lineLength) {
str = (str || '').toString();
lineLength = lineLength || 76;
if (str.length <= lineLength) {
return str;
}
let result = [];
let pos = 0;
let chunkLength = lineLength * 1024;
while (pos < str.length) {
let wrappedLines = str
.substr(pos, chunkLength)
.replace(new RegExp('.{' + lineLength + '}', 'g'), '$&\r\n')
.trim();
result.push(wrappedLines);
pos += chunkLength;
}
return result.join('\r\n').trim();
}
/**
* Creates a transform stream for encoding data to base64 encoding
*
* @constructor
* @param {Object} options Stream options
* @param {Number} [options.lineLength=76] Maximum lenght for lines, set to false to disable wrapping
*/
class Encoder extends Transform {
constructor(options) {
super();
// init Transform
this.options = options || {};
if (this.options.lineLength !== false) {
this.options.lineLength = Number(this.options.lineLength) || 76;
}
this.skipStartBytes = Number(this.options.skipStartBytes) || 0;
this.limitOutbutBytes = Number(this.options.limitOutbutBytes) || 0;
// startPadding can be used together with skipStartBytes
this._curLine = this.options.startPadding || '';
this._remainingBytes = false;
this.inputBytes = 0;
this.outputBytes = 0;
}
_writeChunk(chunk /*, isFinal */) {
if (this.skipStartBytes) {
if (chunk.length <= this.skipStartBytes) {
this.skipStartBytes -= chunk.length;
return;
}
chunk = chunk.slice(this.skipStartBytes);
this.skipStartBytes = 0;
}
if (this.limitOutbutBytes) {
if (this.outputBytes + chunk.length <= this.limitOutbutBytes) {
// ignore, can use entire chunk
} else if (this.outputBytes >= this.limitOutbutBytes) {
// chunks already processed
return;
} else {
// use partial chunk
chunk = chunk.slice(0, this.limitOutbutBytes - this.outputBytes);
}
}
this.outputBytes += chunk.length;
this.push(chunk);
}
_getWrapped(str, isFinal) {
str = wrap(str, this.options.lineLength);
if (!isFinal && str.length === this.options.lineLength) {
str += '\r\n';
}
return str;
}
_transform(chunk, encoding, done) {
if (encoding !== 'buffer') {
chunk = Buffer.from(chunk, encoding);
}
if (!chunk || !chunk.length) {
return setImmediate(done);
}
this.inputBytes += chunk.length;
if (this._remainingBytes && this._remainingBytes.length) {
chunk = Buffer.concat([this._remainingBytes, chunk], this._remainingBytes.length + chunk.length);
this._remainingBytes = false;
}
if (chunk.length % 3) {
this._remainingBytes = chunk.slice(chunk.length - (chunk.length % 3));
chunk = chunk.slice(0, chunk.length - (chunk.length % 3));
} else {
this._remainingBytes = false;
}
let b64 = this._curLine + encode(chunk);
if (this.options.lineLength) {
b64 = this._getWrapped(b64);
// remove last line as it is still most probably incomplete
let lastLF = b64.lastIndexOf('\n');
if (lastLF < 0) {
this._curLine = b64;
b64 = '';
} else if (lastLF === b64.length - 1) {
this._curLine = '';
} else {
this._curLine = b64.substr(lastLF + 1);
b64 = b64.substr(0, lastLF + 1);
}
}
if (b64) {
this._writeChunk(Buffer.from(b64, 'ascii'), false);
}
setImmediate(done);
}
_flush(done) {
if (this._remainingBytes && this._remainingBytes.length) {
this._curLine += encode(this._remainingBytes);
}
if (this._curLine) {
this._curLine = this._getWrapped(this._curLine, true);
this._writeChunk(Buffer.from(this._curLine, 'ascii'), true);
this._curLine = '';
}
done();
}
}
/**
* Creates a transform stream for decoding base64 encoded strings
*
* @constructor
* @param {Object} options Stream options
*/
class Decoder extends Transform {
constructor(options) {
super();
// init Transform
this.options = options || {};
this._curLine = '';
this.inputBytes = 0;
this.outputBytes = 0;
}
_transform(chunk, encoding, done) {
if (!chunk || !chunk.length) {
return setImmediate(done);
}
this.inputBytes += chunk.length;
let b64 = this._curLine + chunk.toString('ascii');
this._curLine = '';
if (/[^a-zA-Z0-9+/=]/.test(b64)) {
b64 = b64.replace(/[^a-zA-Z0-9+/=]/g, '');
}
if (b64.length < 4) {
this._curLine = b64;
b64 = '';
} else if (b64.length % 4) {
this._curLine = b64.substr(-b64.length % 4);
b64 = b64.substr(0, b64.length - this._curLine.length);
}
if (b64) {
let buf = decode(b64);
this.outputBytes += buf.length;
this.push(buf);
}
setImmediate(done);
}
_flush(done) {
if (this._curLine) {
let buf = decode(this._curLine);
this.outputBytes += buf.length;
this.push(buf);
this._curLine = '';
}
setImmediate(done);
}
}
// expose to the world
module.exports = {
encode,
decode,
wrap,
Encoder,
Decoder
};

View File

@@ -0,0 +1,62 @@
{
"_from": "libbase64@1.2.1",
"_id": "libbase64@1.2.1",
"_inBundle": false,
"_integrity": "sha512-l+nePcPbIG1fNlqMzrh68MLkX/gTxk/+vdvAb388Ssi7UuUN31MI44w4Yf33mM3Cm4xDfw48mdf3rkdHszLNew==",
"_location": "/libbase64",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "libbase64@1.2.1",
"name": "libbase64",
"escapedName": "libbase64",
"rawSpec": "1.2.1",
"saveSpec": null,
"fetchSpec": "1.2.1"
},
"_requiredBy": [
"/libmime",
"/mailsplit"
],
"_resolved": "https://registry.npmjs.org/libbase64/-/libbase64-1.2.1.tgz",
"_shasum": "fb93bf4cb6d730f29b92155b6408d1bd2176a8c8",
"_spec": "libbase64@1.2.1",
"_where": "/data/node_modules/libmime",
"author": {
"name": "Andris Reinman"
},
"bugs": {
"url": "https://github.com/nodemailer/libbase64/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "Encode and decode base64 encoded strings",
"devDependencies": {
"chai": "4.2.0",
"eslint-config-nodemailer": "1.2.0",
"eslint-config-prettier": "6.0.0",
"grunt": "1.0.4",
"grunt-cli": "1.3.2",
"grunt-eslint": "22.0.0",
"grunt-mocha-test": "0.13.3",
"mocha": "6.2.0"
},
"homepage": "https://github.com/nodemailer/libbase64",
"keywords": [
"base64",
"mime"
],
"license": "MIT",
"main": "lib/libbase64.js",
"name": "libbase64",
"repository": {
"type": "git",
"url": "git://github.com/nodemailer/libbase64.git"
},
"scripts": {
"test": "grunt"
},
"version": "1.2.1"
}