Initial backup 2026-02-17

This commit is contained in:
Krilly
2026-02-17 15:50:53 +00:00
commit 8902a93add
941 changed files with 131420 additions and 0 deletions

View File

@@ -0,0 +1 @@
node_modules

View File

@@ -0,0 +1,6 @@
REPORTER = spec
test:
@NODE_ENV=test ./node_modules/.bin/mocha --reporter $(REPORTER) -u bdd --require should
.PHONY: test

33
skills/imap-smtp-email/node_modules/uuencode/README.md generated vendored Normal file
View File

@@ -0,0 +1,33 @@
uuencode
========
Node.js implementation of the Unix program uuencode.
More information on the uuencode encoding can be found [here](http://en.wikipedia.org/wiki/Uuencoding).
Installation
--------
npm install -g uuencode
Examples
--------
The following examples show you how to use uuencode.
```javascript
var uuencode = require('uuencode');
// encode something
var encoded = uuencode.encode('Unix-to-Unix encoding');
// '556YI>"UT;RU5;FEX(&5N8V]D:6YG\n'
// decode something
var decoded = uuencode.decode('556YI>"UT;RU5;FEX(&5N8V]D:6YG\n');
// 'Unix-to-Unix encoding'
```
Running Tests
----
$ npm test

152
skills/imap-smtp-email/node_modules/uuencode/index.js generated vendored Normal file
View File

@@ -0,0 +1,152 @@
/* jshint node: true */
/* jshint bitwise:false */
'use strict';
// public functions
/**
* uuencode a value
*
* @param {(String|Buffer)} The value to be encoded.
* @returns {String} The encoded value.
*/
function encode(inString) {
var stop = false;
var inIndex = 0;
var outIndex = 0;
var bytesRead = 0;
var inBytes = new Buffer(inString);
var buffLen = inBytes.length;
var outBytes = new Buffer(buffLen + buffLen / 3 + 1 + buffLen / 45 * 2 + 2 + 4);
do {
var n;
var bytesLeft = buffLen - bytesRead;
if (bytesLeft === 0) {
break;
}
if (bytesLeft <= 45) {
n = bytesLeft;
} else {
n = 45;
}
outBytes[outIndex++] = (n & 0x3F) + 32;
for (var i = 0; i < n; i += 3) {
if (buffLen - inIndex < 3) {
var padding = new Array(3);
var z = 0;
while (inIndex + z < buffLen) {
padding[z] = inBytes[inIndex + z];
++z;
}
encodeBytes(padding, 0, outBytes, outIndex);
} else {
encodeBytes(inBytes, inIndex, outBytes, outIndex);
}
inIndex += 3;
outIndex += 4;
}
outBytes[outIndex++] = 10;
bytesRead += n;
if (n >= 45) {
continue;
}
stop = true;
} while (!stop);
return outBytes.toString().substring(0, outIndex);
}
/**
* uudecode a value
*
* @param {(String|Buffer)} The value to be decoded.
* @returns {Buffer} The decoded value.
*/
function decode(inString) {
var stop = false;
var inIndex = 0;
var outIndex = 0;
var totalLen = 0;
var inBytes = new Buffer(inString);
var buffLen = inBytes.length;
var outBytes = new Buffer(buffLen);
do {
if (inIndex < buffLen) {
var n = inBytes[inIndex] - 32 & 0x3F;
++inIndex;
if (n > 45) {
throw 'Invalid Data';
}
if (n < 45) {
stop = true;
}
totalLen += n;
while (n > 0) {
decodeChars(inBytes, inIndex, outBytes, outIndex);
outIndex += 3;
inIndex += 4;
n -= 3;
}
++inIndex;
} else {
stop = true;
}
} while (!stop);
return outBytes.slice(0, totalLen);
}
// private helper functions
function encodeBytes(inBytes, inIndex, outBytes, outIndex) {
var c1 = inBytes[inIndex] >>> 2;
var c2 = inBytes[inIndex] << 4 & 0x30 | inBytes[inIndex + 1] >>> 4 & 0xF;
var c3 = inBytes[inIndex + 1] << 2 & 0x3C | inBytes[inIndex + 2] >>> 6 & 0x3;
var c4 = inBytes[inIndex + 2] & 0x3F;
outBytes[outIndex] = (c1 & 0x3F) + 32;
outBytes[outIndex + 1] = (c2 & 0x3F) + 32;
outBytes[outIndex + 2] = (c3 & 0x3F) + 32;
outBytes[outIndex + 3] = (c4 & 0x3F) + 32;
}
function decodeChars(inBytes, inIndex, outBytes, outIndex) {
var c1 = inBytes[inIndex];
var c2 = inBytes[inIndex + 1];
var c3 = inBytes[inIndex + 2];
var c4 = inBytes[inIndex + 3];
var b1 = (c1 - 32 & 0x3F) << 2 | (c2 - 32 & 0x3F) >> 4;
var b2 = (c2 - 32 & 0x3F) << 4 | (c3 - 32 & 0x3F) >> 2;
var b3 = (c3 - 32 & 0x3F) << 6 | c4 - 32 & 0x3F;
outBytes[outIndex] = b1 & 0xFF;
outBytes[outIndex + 1] = b2 & 0xFF;
outBytes[outIndex + 2] = b3 & 0xFF;
}
// exports
module.exports = {
encode: encode,
decode: decode
};

View File

@@ -0,0 +1,25 @@
{
"name": "uuencode",
"description": "Node.js implementation of the Unix program uuencode.",
"version": "0.0.4",
"author": {
"name": "Zac Barton"
},
"scripts": {
"test": "make test"
},
"repository": {
"type": "git",
"url": "https://github.com/zacbarton/node-uuencode"
},
"devDependencies": {
"mocha": "2.1.0",
"should": "5.0.1"
},
"keywords": [
"uuencode",
"uudecode",
"encode",
"decode"
]
}

View File

@@ -0,0 +1,83 @@
var fs = require('fs');
var crypto = require('crypto');
var exec = require('child_process').exec;
var uuencode = require('../');
describe('uuencode', function() {
// encode
it('should encode a string and match', function(done) {
uuencode.encode('Cat').should.equal('#0V%T\n');
done();
});
it('should encoded a buffer and match', function(done) {
uuencode.encode(new Buffer('Cat')).should.equal('#0V%T\n');
done();
});
// decode
it('should decode a string and match', function(done) {
uuencode.decode('#0V%T\n').toString().should.equal('Cat');
done();
});
it('should decode a buffer and match', function(done) {
uuencode.decode(new Buffer('#0V%T\n')).toString().should.equal('Cat');
done();
});
// uuencode/uudecode utility
it('should encode and match the uuencode utility', function(done) {
var buf = crypto.randomBytes(512);
var data = buf.toString();
fs.writeFileSync('/tmp/uu-rand', data);
var node = uuencode.encode(data);
exec('uuencode /tmp/uu-rand test', function(err, stdout, stderr) {
// http://en.wikipedia.org/wiki/Uuencoding#Uuencode_table
// Note that 96 ("`" grave accent) is a character that is seen in
// uuencoded files but is typically only used to signify a 0-length
// line, usually at the end of a file. It will never naturally occur
// in the actual converted data since it is outside the range of 32
// to 95. The sole exception to this is that some uuencoding
// programs use the grave accent to signify padding bytes instead of
// a space. However, the character used for the padding byte is not
// standardized, so either is a possibility.
stdout = stdout.replace(/`/g, ' ');
stdout.should.containEql(node);
done();
});
});
it('should decode and match the uudecode utility', function(done) {
var buf = crypto.randomBytes(512);
var data = buf.toString();
fs.writeFileSync('/tmp/uu-random', data);
exec('uuencode /tmp/uu-rand /tmp/uu-res', function(err, stdout, stderr) {
fs.writeFileSync('/tmp/uu-res', stdout);
exec('uudecode /tmp/uu-res', function(err2, stdout2, stderr2) {
var uudecode = fs.readFileSync('/tmp/uu-res').toString();
// remove the header and footer as this module doesnt produce
// them
var cleaned = stdout.split('\n');
cleaned.shift();
cleaned.pop();
cleaned.pop();
var node = uuencode.decode(cleaned.join('\n')).toString();
uudecode.should.containEql(node);
done();
});
});
});
});