mirror of
https://github.com/MrUnknownDE/UnknownBot.git
synced 2026-04-22 14:13:43 +02:00
start nodejs bot
This commit is contained in:
26
node_modules/seek-bzip/LICENSE
generated
vendored
Normal file
26
node_modules/seek-bzip/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright © 2013-2015 C. Scott Ananian
|
||||
|
||||
Copyright © 2012-2015 Eli Skeggs
|
||||
|
||||
Copyright © 2011 Kevin Kwok
|
||||
|
||||
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.
|
||||
185
node_modules/seek-bzip/README.md
generated
vendored
Normal file
185
node_modules/seek-bzip/README.md
generated
vendored
Normal file
@@ -0,0 +1,185 @@
|
||||
# seek-bzip
|
||||
|
||||
[![Build Status][1]][2] [![dependency status][3]][4] [![dev dependency status][5]][6]
|
||||
|
||||
`seek-bzip` is a pure-javascript Node.JS module adapted from [node-bzip](https://github.com/skeggse/node-bzip) and before that [antimatter15's pure-javascript bzip2 decoder](https://github.com/antimatter15/bzip2.js). Like these projects, `seek-bzip` only does decompression (see [compressjs](https://github.com/cscott/compressjs) if you need compression code). Unlike those other projects, `seek-bzip` can seek to and decode single blocks from the bzip2 file.
|
||||
|
||||
`seek-bzip` primarily decodes buffers into other buffers, synchronously.
|
||||
With the help of the [fibers](https://github.com/laverdet/node-fibers)
|
||||
package, it can operate on node streams; see `test/stream.js` for an
|
||||
example.
|
||||
|
||||
## How to Install
|
||||
|
||||
```
|
||||
npm install seek-bzip
|
||||
```
|
||||
|
||||
This package uses
|
||||
[Typed Arrays](https://developer.mozilla.org/en-US/docs/JavaScript/Typed_arrays), which are present in node.js >= 0.5.5.
|
||||
|
||||
## Usage
|
||||
|
||||
After compressing some example data into `example.bz2`, the following will recreate that original data and save it to `example`:
|
||||
|
||||
```
|
||||
var Bunzip = require('seek-bzip');
|
||||
var fs = require('fs');
|
||||
|
||||
var compressedData = fs.readFileSync('example.bz2');
|
||||
var data = Bunzip.decode(compressedData);
|
||||
|
||||
fs.writeFileSync('example', data);
|
||||
```
|
||||
|
||||
See the tests in the `tests/` directory for further usage examples.
|
||||
|
||||
For uncompressing single blocks of bzip2-compressed data, you will need
|
||||
an out-of-band index listing the start of each bzip2 block. (Presumably
|
||||
you generate this at the same time as you index the start of the information
|
||||
you wish to seek to inside the compressed file.) The `seek-bzip` module
|
||||
has been designed to be compatible with the C implementation `seek-bzip2`
|
||||
available from https://bitbucket.org/james_taylor/seek-bzip2. That codebase
|
||||
contains a `bzip-table` tool which will generate bzip2 block start indices.
|
||||
There is also a pure-JavaScript `seek-bzip-table` tool in this package's
|
||||
`bin` directory.
|
||||
|
||||
## Documentation
|
||||
|
||||
`require('seek-bzip')` returns a `Bunzip` object. It contains three static
|
||||
methods. The first is a function accepting one or two parameters:
|
||||
|
||||
`Bunzip.decode = function(input, [Number expectedSize] or [output], [boolean multistream])`
|
||||
|
||||
The `input` argument can be a "stream" object (which must implement the
|
||||
`readByte` method), or a `Buffer`.
|
||||
|
||||
If `expectedSize` is not present, `decodeBzip` simply decodes `input` and
|
||||
returns the resulting `Buffer`.
|
||||
|
||||
If `expectedSize` is present (and numeric), `decodeBzip` will store
|
||||
the results in a `Buffer` of length `expectedSize`, and throw an error
|
||||
in the case that the size of the decoded data does not match
|
||||
`expectedSize`.
|
||||
|
||||
If you pass a non-numeric second parameter, it can either be a `Buffer`
|
||||
object (which must be of the correct length; an error will be thrown if
|
||||
the size of the decoded data does not match the buffer length) or
|
||||
a "stream" object (which must implement a `writeByte` method).
|
||||
|
||||
The optional third `multistream` parameter, if true, attempts to continue
|
||||
reading past the end of the bzip2 file. This supports "multistream"
|
||||
bzip2 files, which are simply multiple bzip2 files concatenated together.
|
||||
If this argument is true, the input stream must have an `eof` method
|
||||
which returns true when the end of the input has been reached.
|
||||
|
||||
The second exported method is a function accepting two or three parameters:
|
||||
|
||||
`Bunzip.decodeBlock = function(input, Number blockStartBits, [Number expectedSize] or [output])`
|
||||
|
||||
The `input` and `expectedSize`/`output` parameters are as above.
|
||||
The `blockStartBits` parameter gives the start of the desired block, in bits.
|
||||
|
||||
If passing a stream as the `input` parameter, it must implement the
|
||||
`seek` method.
|
||||
|
||||
The final exported method is a function accepting two or three parameters:
|
||||
|
||||
`Bunzip.table = function(input, Function callback, [boolean multistream])`
|
||||
|
||||
The `input` and `multistream` parameters are identical to those for the
|
||||
`decode` method.
|
||||
|
||||
This function will invoke `callback(position, size)` once per bzip2 block,
|
||||
where `position` gives the starting position of the block (in *bits*), and
|
||||
`size` gives the uncompressed size of the block (in bytes).
|
||||
|
||||
This can be used to construct an index allowing direct access to a particular
|
||||
block inside a bzip2 file, using the `decodeBlock` method.
|
||||
|
||||
## Command-line
|
||||
There are binaries available in bin. The first generates an index of all
|
||||
the blocks in a bzip2-compressed file:
|
||||
```
|
||||
$ bin/seek-bzip-table test/sample4.bz2
|
||||
32 99981
|
||||
320555 99981
|
||||
606348 99981
|
||||
847568 99981
|
||||
1089094 99981
|
||||
1343625 99981
|
||||
1596228 99981
|
||||
1843336 99981
|
||||
2090919 99981
|
||||
2342106 39019
|
||||
$
|
||||
```
|
||||
The first field is the starting position of the block, in bits, and the
|
||||
second field is the length of the block, in bytes.
|
||||
|
||||
The second binary decodes an arbitrary block of a bzip2 file:
|
||||
```
|
||||
$ bin/seek-bunzip -d -b 2342106 test/sample4.bz2 | tail
|
||||
élan's
|
||||
émigré
|
||||
émigré's
|
||||
émigrés
|
||||
épée
|
||||
épée's
|
||||
épées
|
||||
étude
|
||||
étude's
|
||||
études
|
||||
$
|
||||
```
|
||||
|
||||
Use `--help` to see other options.
|
||||
|
||||
## Help wanted
|
||||
|
||||
Improvements to this module would be generally useful.
|
||||
Feel free to fork on github and submit pull requests!
|
||||
|
||||
## Related projects
|
||||
|
||||
* https://github.com/skeggse/node-bzip node-bzip (original upstream source)
|
||||
* https://github.com/cscott/compressjs
|
||||
Lots of compression/decompression algorithms from the same author as this
|
||||
module, including bzip2 compression code.
|
||||
* https://github.com/cscott/lzjb fast LZJB compression/decompression
|
||||
|
||||
## License
|
||||
|
||||
#### MIT License
|
||||
|
||||
> Copyright © 2013-2015 C. Scott Ananian
|
||||
>
|
||||
> Copyright © 2012-2015 Eli Skeggs
|
||||
>
|
||||
> Copyright © 2011 Kevin Kwok
|
||||
>
|
||||
> 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.
|
||||
|
||||
[1]: https://travis-ci.org/cscott/seek-bzip.png
|
||||
[2]: https://travis-ci.org/cscott/seek-bzip
|
||||
[3]: https://david-dm.org/cscott/seek-bzip.png
|
||||
[4]: https://david-dm.org/cscott/seek-bzip
|
||||
[5]: https://david-dm.org/cscott/seek-bzip/dev-status.png
|
||||
[6]: https://david-dm.org/cscott/seek-bzip#info=devDependencies
|
||||
129
node_modules/seek-bzip/bin/seek-bunzip
generated
vendored
Normal file
129
node_modules/seek-bzip/bin/seek-bunzip
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var program = require('commander');
|
||||
var Bunzip = require('../');
|
||||
var fs = require('fs');
|
||||
|
||||
program
|
||||
.version(Bunzip.version)
|
||||
.usage('-d|-z [infile] [outfile]')
|
||||
.option('-d, --decompress',
|
||||
'Decompress stdin to stdout')
|
||||
//.option('-z, --compress',
|
||||
// 'Compress stdin to stdout')
|
||||
.option('-b, --block <n>',
|
||||
'Extract a single block, starting at <n> bits.', undefined)
|
||||
.option('-m, --multistream',
|
||||
'Read a multistream bzip2 file');
|
||||
program.on('--help', function() {
|
||||
console.log(' If <infile> is omitted, reads from stdin.');
|
||||
console.log(' If <outfile> is omitted, writes to stdout.');
|
||||
});
|
||||
program.parse(process.argv);
|
||||
|
||||
if (!program.compress) { program.decompress = true; }
|
||||
|
||||
if (program.compress && program.block !== undefined) {
|
||||
console.error('--block can only be used with decompression');
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (program.decompress && program.compress) {
|
||||
console.error('Must specify either -d or -z.');
|
||||
return 1;
|
||||
}
|
||||
|
||||
var makeInStream = function(in_fd) {
|
||||
var stat = fs.fstatSync(in_fd);
|
||||
var stream = {
|
||||
buffer: new Buffer(4096),
|
||||
filePos: null,
|
||||
pos: 0,
|
||||
end: 0,
|
||||
_fillBuffer: function() {
|
||||
this.end = fs.readSync(in_fd, this.buffer, 0, this.buffer.length,
|
||||
this.filePos);
|
||||
this.pos = 0;
|
||||
if (this.filePos !== null && this.end > 0) {
|
||||
this.filePos += this.end;
|
||||
}
|
||||
},
|
||||
readByte: function() {
|
||||
if (this.pos >= this.end) { this._fillBuffer(); }
|
||||
if (this.pos < this.end) {
|
||||
return this.buffer[this.pos++];
|
||||
}
|
||||
return -1;
|
||||
},
|
||||
read: function(buffer, bufOffset, length) {
|
||||
if (this.pos >= this.end) { this._fillBuffer(); }
|
||||
var bytesRead = 0;
|
||||
while (bytesRead < length && this.pos < this.end) {
|
||||
buffer[bufOffset++] = this.buffer[this.pos++];
|
||||
bytesRead++;
|
||||
}
|
||||
return bytesRead;
|
||||
},
|
||||
seek: function(seek_pos) {
|
||||
this.filePos = seek_pos;
|
||||
this.pos = this.end = 0;
|
||||
},
|
||||
eof: function() {
|
||||
if (this.pos >= this.end) { this._fillBuffer(); }
|
||||
return !(this.pos < this.end);
|
||||
}
|
||||
};
|
||||
if (stat.size) {
|
||||
stream.size = stat.size;
|
||||
}
|
||||
return stream;
|
||||
};
|
||||
var makeOutStream = function(out_fd) {
|
||||
return {
|
||||
buffer: new Buffer(4096),
|
||||
pos: 0,
|
||||
flush: function() {
|
||||
fs.writeSync(out_fd, this.buffer, 0, this.pos);
|
||||
this.pos = 0;
|
||||
},
|
||||
writeByte: function(byte) {
|
||||
if (this.pos >= this.buffer.length) { this.flush(); }
|
||||
this.buffer[this.pos++] = byte;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var in_fd = 0, close_in = function(){};
|
||||
var out_fd = 1, close_out = function(){};
|
||||
if (program.args.length > 0) {
|
||||
in_fd = fs.openSync(program.args.shift(), 'r');
|
||||
close_in = function() { fs.closeSync(in_fd); };
|
||||
}
|
||||
if (program.args.length > 0) {
|
||||
out_fd = fs.openSync(program.args.shift(), 'w');
|
||||
close_out = function() { fs.closeSync(out_fd); };
|
||||
}
|
||||
|
||||
var inStream = makeInStream(in_fd);
|
||||
var outStream= makeOutStream(out_fd);
|
||||
|
||||
if (program.decompress) {
|
||||
try {
|
||||
if (program.block !== undefined) {
|
||||
Bunzip.decodeBlock(inStream, +program.block, outStream);
|
||||
} else {
|
||||
Bunzip.decode(inStream, outStream, program.multistream);
|
||||
}
|
||||
outStream.flush();
|
||||
} catch (e) {
|
||||
if (e.code !== 'EPIPE') throw e;
|
||||
}
|
||||
close_in();
|
||||
close_out();
|
||||
return 0;
|
||||
}
|
||||
if (program.compress) {
|
||||
console.error('Compression not yet implemented.');
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
71
node_modules/seek-bzip/bin/seek-bzip-table
generated
vendored
Normal file
71
node_modules/seek-bzip/bin/seek-bzip-table
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var program = require('commander');
|
||||
var Bunzip = require('../');
|
||||
var fs = require('fs');
|
||||
|
||||
program
|
||||
.version(Bunzip.version)
|
||||
.usage('[infile]')
|
||||
.option('-m, --multistream',
|
||||
'Read a multistream bzip2 file');
|
||||
program.on('--help', function() {
|
||||
console.log(' If <infile> is omitted, reads from stdin.');
|
||||
});
|
||||
program.parse(process.argv);
|
||||
|
||||
var makeInStream = function(in_fd) {
|
||||
var stat = fs.fstatSync(in_fd);
|
||||
var stream = {
|
||||
buffer: new Buffer(4096),
|
||||
totalPos: 0,
|
||||
pos: 0,
|
||||
end: 0,
|
||||
_fillBuffer: function() {
|
||||
this.end = fs.readSync(in_fd, this.buffer, 0, this.buffer.length);
|
||||
this.pos = 0;
|
||||
},
|
||||
readByte: function() {
|
||||
if (this.pos >= this.end) { this._fillBuffer(); }
|
||||
if (this.pos < this.end) {
|
||||
this.totalPos++;
|
||||
return this.buffer[this.pos++];
|
||||
}
|
||||
return -1;
|
||||
},
|
||||
read: function(buffer, bufOffset, length) {
|
||||
if (this.pos >= this.end) { this._fillBuffer(); }
|
||||
var bytesRead = 0;
|
||||
while (bytesRead < length && this.pos < this.end) {
|
||||
buffer[bufOffset++] = this.buffer[this.pos++];
|
||||
bytesRead++;
|
||||
}
|
||||
this.totalPos += bytesRead;
|
||||
return bytesRead;
|
||||
},
|
||||
eof: function() {
|
||||
if (this.pos >= this.end) { this._fillBuffer(); }
|
||||
return !(this.pos < this.end);
|
||||
}
|
||||
};
|
||||
if (stat.size) {
|
||||
stream.size = stat.size;
|
||||
}
|
||||
return stream;
|
||||
};
|
||||
|
||||
var in_fd = 0, close_in = function(){};
|
||||
if (program.args.length > 0) {
|
||||
in_fd = fs.openSync(program.args.shift(), 'r');
|
||||
close_in = function() { fs.closeSync(in_fd); };
|
||||
}
|
||||
|
||||
var inStream = makeInStream(in_fd);
|
||||
|
||||
var report = function(position, blocksize) {
|
||||
console.log(position+'\t'+blocksize);
|
||||
};
|
||||
|
||||
Bunzip.table(inStream, report, program.multistream);
|
||||
close_in();
|
||||
return 0;
|
||||
73
node_modules/seek-bzip/package.json
generated
vendored
Normal file
73
node_modules/seek-bzip/package.json
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"_from": "seek-bzip@^1.0.5",
|
||||
"_id": "seek-bzip@1.0.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-e1QtP3YL5tWww8uKaOCQ18UxIT2laNBXHjV/S2WYCiK4udiv8lkG89KRIoCjUagnAmCBurjF4zEVX2ByBbnCjQ==",
|
||||
"_location": "/seek-bzip",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "seek-bzip@^1.0.5",
|
||||
"name": "seek-bzip",
|
||||
"escapedName": "seek-bzip",
|
||||
"rawSpec": "^1.0.5",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.5"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/decompress-tarbz2"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.6.tgz",
|
||||
"_shasum": "35c4171f55a680916b52a07859ecf3b5857f21c4",
|
||||
"_spec": "seek-bzip@^1.0.5",
|
||||
"_where": "C:\\Users\\MCGFX\\OneDrive\\Dokumente\\GitHub\\UnknownBot\\node_modules\\decompress-tarbz2",
|
||||
"bin": {
|
||||
"seek-bunzip": "bin/seek-bunzip",
|
||||
"seek-table": "bin/seek-bzip-table"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/cscott/seek-bzip/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "C. Scott Ananian",
|
||||
"url": "http://cscott.net"
|
||||
},
|
||||
{
|
||||
"name": "Eli Skeggs"
|
||||
},
|
||||
{
|
||||
"name": "Kevin Kwok"
|
||||
},
|
||||
{
|
||||
"name": "Rob Landley",
|
||||
"url": "http://landley.net"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"commander": "^2.8.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "a pure-JavaScript Node.JS module for random-access decoding bzip2 data",
|
||||
"devDependencies": {
|
||||
"fibers": "~1.0.6",
|
||||
"mocha": "~2.2.5"
|
||||
},
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"homepage": "https://github.com/cscott/seek-bzip#readme",
|
||||
"license": "MIT",
|
||||
"main": "./lib/index.js",
|
||||
"name": "seek-bzip",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/cscott/seek-bzip.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "1.0.6"
|
||||
}
|
||||
Reference in New Issue
Block a user