Initial
This commit is contained in:
22
resources/app/node_modules/crc32-stream/LICENSE
generated
vendored
Normal file
22
resources/app/node_modules/crc32-stream/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2014 Chris Talkington, contributors.
|
||||
|
||||
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.
|
||||
48
resources/app/node_modules/crc32-stream/lib/crc32-stream.js
generated
vendored
Normal file
48
resources/app/node_modules/crc32-stream/lib/crc32-stream.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* node-crc32-stream
|
||||
*
|
||||
* Copyright (c) 2014 Chris Talkington, contributors.
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/archiverjs/node-crc32-stream/blob/master/LICENSE-MIT
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const {Transform} = require('readable-stream');
|
||||
|
||||
const crc32 = require('crc-32');
|
||||
|
||||
class CRC32Stream extends Transform {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
this.checksum = Buffer.allocUnsafe(4);
|
||||
this.checksum.writeInt32BE(0, 0);
|
||||
|
||||
this.rawSize = 0;
|
||||
}
|
||||
|
||||
_transform(chunk, encoding, callback) {
|
||||
if (chunk) {
|
||||
this.checksum = crc32.buf(chunk, this.checksum) >>> 0;
|
||||
this.rawSize += chunk.length;
|
||||
}
|
||||
|
||||
callback(null, chunk);
|
||||
}
|
||||
|
||||
digest(encoding) {
|
||||
const checksum = Buffer.allocUnsafe(4);
|
||||
checksum.writeUInt32BE(this.checksum >>> 0, 0);
|
||||
return encoding ? checksum.toString(encoding) : checksum;
|
||||
}
|
||||
|
||||
hex() {
|
||||
return this.digest('hex').toUpperCase();
|
||||
}
|
||||
|
||||
size() {
|
||||
return this.rawSize;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = CRC32Stream;
|
||||
62
resources/app/node_modules/crc32-stream/lib/deflate-crc32-stream.js
generated
vendored
Normal file
62
resources/app/node_modules/crc32-stream/lib/deflate-crc32-stream.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* node-crc32-stream
|
||||
*
|
||||
* Copyright (c) 2014 Chris Talkington, contributors.
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/archiverjs/node-crc32-stream/blob/master/LICENSE-MIT
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const {DeflateRaw} = require('zlib');
|
||||
|
||||
const crc32 = require('crc-32');
|
||||
|
||||
class DeflateCRC32Stream extends DeflateRaw {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
|
||||
this.checksum = Buffer.allocUnsafe(4);
|
||||
this.checksum.writeInt32BE(0, 0);
|
||||
|
||||
this.rawSize = 0;
|
||||
this.compressedSize = 0;
|
||||
}
|
||||
|
||||
push(chunk, encoding) {
|
||||
if (chunk) {
|
||||
this.compressedSize += chunk.length;
|
||||
}
|
||||
|
||||
return super.push(chunk, encoding);
|
||||
}
|
||||
|
||||
_transform(chunk, encoding, callback) {
|
||||
if (chunk) {
|
||||
this.checksum = crc32.buf(chunk, this.checksum) >>> 0;
|
||||
this.rawSize += chunk.length;
|
||||
}
|
||||
|
||||
super._transform(chunk, encoding, callback)
|
||||
}
|
||||
|
||||
digest(encoding) {
|
||||
const checksum = Buffer.allocUnsafe(4);
|
||||
checksum.writeUInt32BE(this.checksum >>> 0, 0);
|
||||
return encoding ? checksum.toString(encoding) : checksum;
|
||||
}
|
||||
|
||||
hex() {
|
||||
return this.digest('hex').toUpperCase();
|
||||
}
|
||||
|
||||
size(compressed = false) {
|
||||
if (compressed) {
|
||||
return this.compressedSize;
|
||||
} else {
|
||||
return this.rawSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DeflateCRC32Stream;
|
||||
14
resources/app/node_modules/crc32-stream/lib/index.js
generated
vendored
Normal file
14
resources/app/node_modules/crc32-stream/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* node-crc32-stream
|
||||
*
|
||||
* Copyright (c) 2014 Chris Talkington, contributors.
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/archiverjs/node-crc32-stream/blob/master/LICENSE-MIT
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
CRC32Stream: require('./crc32-stream'),
|
||||
DeflateCRC32Stream: require('./deflate-crc32-stream')
|
||||
}
|
||||
33
resources/app/node_modules/crc32-stream/package.json
generated
vendored
Normal file
33
resources/app/node_modules/crc32-stream/package.json
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "crc32-stream",
|
||||
"version": "5.0.1",
|
||||
"description": "a streaming CRC32 checksumer",
|
||||
"homepage": "https://github.com/archiverjs/node-crc32-stream",
|
||||
"author": {
|
||||
"name": "Chris Talkington",
|
||||
"url": "http://christalkington.com/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/archiverjs/node-crc32-stream.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"crc-32": "^1.2.0",
|
||||
"readable-stream": "^3.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "4.4.1",
|
||||
"mocha": "9.2.2"
|
||||
},
|
||||
"publishConfig": {
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user