mirror of
https://github.com/MrUnknownDE/UnknownBot.git
synced 2026-04-11 10:13:45 +02:00
start nodejs bot
This commit is contained in:
24
node_modules/unbzip2-stream/LICENSE
generated
vendored
Normal file
24
node_modules/unbzip2-stream/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
Copyright (c) 2017 by Jan Boelsche (jan@lagomorph.de)
|
||||
|
||||
based on bzip2.js - a small bzip2 decompression implementation
|
||||
Copyright 2011 by antimatter15 (antimatter15@gmail.com)
|
||||
|
||||
Based on micro-bunzip by Rob Landley (rob@landley.net).
|
||||
|
||||
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.
|
||||
59
node_modules/unbzip2-stream/README.md
generated
vendored
Normal file
59
node_modules/unbzip2-stream/README.md
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
[](http://badge.fury.io/js/unbzip2-stream)
|
||||
|
||||
unbzip2-stream
|
||||
===
|
||||
streaming bzip2 decompressor in pure JS for Node and browserify.
|
||||
|
||||
Buffers
|
||||
---
|
||||
When browserified, the stream emits instances of [feross/buffer](https://github.com/feross/buffer) instead of raw Uint8Arrays to have a consistant API across browsers and Node.
|
||||
|
||||
Usage
|
||||
---
|
||||
``` js
|
||||
var bz2 = require('unbzip2-stream');
|
||||
var fs = require('fs');
|
||||
|
||||
// decompress test.bz2 and output the result
|
||||
fs.createReadStream('./test.bz2').pipe(bz2()).pipe(process.stdout);
|
||||
```
|
||||
|
||||
Also see [test/browser/download.js](https://github.com/regular/unbzip2-stream/blob/master/test/browser/download.js) for an example of decompressing a file while downloading.
|
||||
|
||||
Or, using a <script> tag
|
||||
---
|
||||
|
||||
```
|
||||
<script src="https://npm-cdn.info/unbzip2-stream/dist/unbzip2-stream.min.js"></script>
|
||||
<script>
|
||||
var myStream = window.unbzip2Stream();
|
||||
// now pipe stuff through it (see above)
|
||||
</script>
|
||||
```
|
||||
|
||||
Tests
|
||||
---
|
||||
To run tests in Node:
|
||||
|
||||
npm run test
|
||||
|
||||
To run tests in PhantomJS
|
||||
|
||||
npm run browser-test
|
||||
|
||||
Additional Tests
|
||||
----------------
|
||||
There are two more tests that specifically test decompression of a very large file. Because I don't want to include large binary files in this repository, the files are created by running an npm script.
|
||||
|
||||
npm run prepare-long-test
|
||||
|
||||
You can now
|
||||
|
||||
npm run long-test
|
||||
|
||||
And to run a test in chrome that downloads and decompresses a large binary file
|
||||
|
||||
npm run download-test
|
||||
|
||||
Open the browser's console to see the output.
|
||||
|
||||
93
node_modules/unbzip2-stream/index.js
generated
vendored
Normal file
93
node_modules/unbzip2-stream/index.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
var through = require('through');
|
||||
var bz2 = require('./lib/bzip2');
|
||||
var bitIterator = require('./lib/bit_iterator');
|
||||
|
||||
module.exports = unbzip2Stream;
|
||||
|
||||
function unbzip2Stream() {
|
||||
var bufferQueue = [];
|
||||
var hasBytes = 0;
|
||||
var blockSize = 0;
|
||||
var broken = false;
|
||||
var done = false;
|
||||
var bitReader = null;
|
||||
var streamCRC = null;
|
||||
|
||||
function decompressBlock(push){
|
||||
if(!blockSize){
|
||||
blockSize = bz2.header(bitReader);
|
||||
//console.error("got header of", blockSize);
|
||||
streamCRC = 0;
|
||||
return true;
|
||||
}else{
|
||||
var bufsize = 100000 * blockSize;
|
||||
var buf = new Int32Array(bufsize);
|
||||
|
||||
var chunk = [];
|
||||
var f = function(b) {
|
||||
chunk.push(b);
|
||||
};
|
||||
|
||||
streamCRC = bz2.decompress(bitReader, f, buf, bufsize, streamCRC);
|
||||
if (streamCRC === null) {
|
||||
// reset for next bzip2 header
|
||||
blockSize = 0;
|
||||
return false;
|
||||
}else{
|
||||
//console.error('decompressed', chunk.length,'bytes');
|
||||
push(Buffer.from(chunk));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var outlength = 0;
|
||||
function decompressAndQueue(stream) {
|
||||
if (broken) return;
|
||||
try {
|
||||
return decompressBlock(function(d) {
|
||||
stream.queue(d);
|
||||
if (d !== null) {
|
||||
//console.error('write at', outlength.toString(16));
|
||||
outlength += d.length;
|
||||
} else {
|
||||
//console.error('written EOS');
|
||||
}
|
||||
});
|
||||
} catch(e) {
|
||||
//console.error(e);
|
||||
stream.emit('error', e);
|
||||
broken = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return through(
|
||||
function write(data) {
|
||||
//console.error('received', data.length,'bytes in', typeof data);
|
||||
bufferQueue.push(data);
|
||||
hasBytes += data.length;
|
||||
if (bitReader === null) {
|
||||
bitReader = bitIterator(function() {
|
||||
return bufferQueue.shift();
|
||||
});
|
||||
}
|
||||
while (!broken && hasBytes - bitReader.bytesRead + 1 >= ((25000 + 100000 * blockSize) || 4)){
|
||||
//console.error('decompressing with', hasBytes - bitReader.bytesRead + 1, 'bytes in buffer');
|
||||
decompressAndQueue(this);
|
||||
}
|
||||
},
|
||||
function end(x) {
|
||||
//console.error(x,'last compressing with', hasBytes, 'bytes in buffer');
|
||||
while (!broken && bitReader && hasBytes > bitReader.bytesRead){
|
||||
decompressAndQueue(this);
|
||||
}
|
||||
if (!broken) {
|
||||
if (streamCRC !== null)
|
||||
this.emit('error', new Error("input stream ended prematurely"));
|
||||
this.queue(null);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
80
node_modules/unbzip2-stream/package.json
generated
vendored
Normal file
80
node_modules/unbzip2-stream/package.json
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"_from": "unbzip2-stream@^1.0.9",
|
||||
"_id": "unbzip2-stream@1.4.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==",
|
||||
"_location": "/unbzip2-stream",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "unbzip2-stream@^1.0.9",
|
||||
"name": "unbzip2-stream",
|
||||
"escapedName": "unbzip2-stream",
|
||||
"rawSpec": "^1.0.9",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.9"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/decompress-tarbz2"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz",
|
||||
"_shasum": "b0da04c4371311df771cdc215e87f2130991ace7",
|
||||
"_spec": "unbzip2-stream@^1.0.9",
|
||||
"_where": "C:\\Users\\MCGFX\\OneDrive\\Dokumente\\GitHub\\UnknownBot\\node_modules\\decompress-tarbz2",
|
||||
"author": {
|
||||
"name": "Jan Bölsche",
|
||||
"email": "jan@lagomorph.de"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/regular/unbzip2-stream/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"buffer": "^5.2.1",
|
||||
"through": "^2.3.8"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "streaming unbzip2 implementation in pure javascript for node and browsers",
|
||||
"devDependencies": {
|
||||
"beefy": "^2.1.8",
|
||||
"brfs": "^1.2.0",
|
||||
"browserify": "^16.2.3",
|
||||
"concat-stream": "^1.4.7",
|
||||
"stream-equal": "^1.1.1",
|
||||
"tape": "^4.9.2",
|
||||
"tape-run": "^4.0.0",
|
||||
"uglify-js": "^3.0.10"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"lib",
|
||||
"dist/unbzip2-stream.min.js"
|
||||
],
|
||||
"homepage": "https://github.com/regular/unbzip2-stream#readme",
|
||||
"keywords": [
|
||||
"bzip",
|
||||
"bzip2",
|
||||
"bz2",
|
||||
"stream",
|
||||
"streaming",
|
||||
"decompress",
|
||||
"through"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "unbzip2-stream",
|
||||
"repository": {
|
||||
"url": "git+https://github.com/regular/unbzip2-stream.git",
|
||||
"type": "git"
|
||||
},
|
||||
"scripts": {
|
||||
"browser-test": "browserify -t brfs test/simple.js | tape-run",
|
||||
"download-test": "beefy test/browser/long.js --open -- -t brfs",
|
||||
"long-test": "tape test/extra/long.js",
|
||||
"prepare": "mkdir -p dist && browserify -s unbzip2Stream index.js | uglifyjs > dist/unbzip2-stream.min.js",
|
||||
"prepare-long-test": "head -c 104857600 < /dev/urandom | tee test/fixtures/vmlinux.bin | bzip2 > test/fixtures/vmlinux.bin.bz2",
|
||||
"test": "tape test/*.js"
|
||||
},
|
||||
"version": "1.4.3"
|
||||
}
|
||||
Reference in New Issue
Block a user