yeet
This commit is contained in:
44
node_modules/node-stream-zip/LICENSE
generated
vendored
Normal file
44
node_modules/node-stream-zip/LICENSE
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
Copyright (c) 2021 Antelle https://github.com/antelle
|
||||
|
||||
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.
|
||||
|
||||
== dependency license: adm-zip ==
|
||||
|
||||
Copyright (c) 2012 Another-D-Mention Software and other contributors,
|
||||
http://www.another-d-mention.ro/
|
||||
|
||||
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.
|
221
node_modules/node-stream-zip/README.md
generated
vendored
Normal file
221
node_modules/node-stream-zip/README.md
generated
vendored
Normal file
@ -0,0 +1,221 @@
|
||||
# node-stream-zip 
|
||||
|
||||
node.js library for reading and extraction of ZIP archives.
|
||||
Features:
|
||||
|
||||
- it never loads entire archive into memory, everything is read by chunks
|
||||
- large archives support
|
||||
- all operations are non-blocking, no sync i/o
|
||||
- fast initialization
|
||||
- no dependencies, no binary addons
|
||||
- decompression with built-in zlib module
|
||||
- deflate, sfx, macosx/windows built-in archives
|
||||
- ZIP64 support
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm i node-stream-zip
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
There are two APIs provided:
|
||||
1. [promise-based / async](#async-api)
|
||||
2. [callbacks](#callback-api)
|
||||
|
||||
It's recommended to use the new, promise API, however the legacy callback API
|
||||
may be more flexible for certain operations.
|
||||
|
||||
### Async API
|
||||
|
||||
Open a zip file
|
||||
```javascript
|
||||
const StreamZip = require('node-stream-zip');
|
||||
const zip = new StreamZip.async({ file: 'archive.zip' });
|
||||
```
|
||||
|
||||
Stream one entry to stdout
|
||||
```javascript
|
||||
const stm = await zip.stream('path/inside/zip.txt');
|
||||
stm.pipe(process.stdout);
|
||||
stm.on('end', () => zip.close());
|
||||
```
|
||||
|
||||
Read a file as buffer
|
||||
```javascript
|
||||
const data = await zip.entryData('path/inside/zip.txt');
|
||||
await zip.close();
|
||||
```
|
||||
|
||||
Extract one file to disk
|
||||
```javascript
|
||||
await zip.extract('path/inside/zip.txt', './extracted.txt');
|
||||
await zip.close();
|
||||
```
|
||||
|
||||
List entries
|
||||
```javascript
|
||||
const entriesCount = await zip.entriesCount;
|
||||
console.log(`Entries read: ${entriesCount}`);
|
||||
|
||||
const entries = await zip.entries();
|
||||
for (const entry of Object.values(entries)) {
|
||||
const desc = entry.isDirectory ? 'directory' : `${entry.size} bytes`;
|
||||
console.log(`Entry ${entry.name}: ${desc}`);
|
||||
}
|
||||
|
||||
// Do not forget to close the file once you're done
|
||||
await zip.close();
|
||||
```
|
||||
|
||||
Extract a folder from archive to disk
|
||||
```javascript
|
||||
fs.mkdirSync('extracted');
|
||||
await zip.extract('path/inside/zip/', './extracted');
|
||||
await zip.close();
|
||||
```
|
||||
|
||||
Extract everything
|
||||
```javascript
|
||||
fs.mkdirSync('extracted');
|
||||
const count = await zip.extract(null, './extracted');
|
||||
console.log(`Extracted ${count} entries`);
|
||||
await zip.close();
|
||||
```
|
||||
|
||||
When extracting a folder, you can listen to `extract` event
|
||||
```javascript
|
||||
zip.on('extract', (entry, file) => {
|
||||
console.log(`Extracted ${entry.name} to ${file}`);
|
||||
});
|
||||
```
|
||||
|
||||
`entry` event is generated for every entry during loading
|
||||
```javascript
|
||||
zip.on('entry', entry => {
|
||||
// you can already stream this entry,
|
||||
// without waiting until all entry descriptions are read (suitable for very large archives)
|
||||
console.log(`Read entry ${entry.name}`);
|
||||
});
|
||||
```
|
||||
|
||||
### Callback API
|
||||
|
||||
Open a zip file
|
||||
```javascript
|
||||
const StreamZip = require('node-stream-zip');
|
||||
const zip = new StreamZip({ file: 'archive.zip' });
|
||||
|
||||
// Handle errors
|
||||
zip.on('error', err => { /*...*/ });
|
||||
```
|
||||
|
||||
List entries
|
||||
```javascript
|
||||
zip.on('ready', () => {
|
||||
console.log('Entries read: ' + zip.entriesCount);
|
||||
for (const entry of Object.values(zip.entries())) {
|
||||
const desc = entry.isDirectory ? 'directory' : `${entry.size} bytes`;
|
||||
console.log(`Entry ${entry.name}: ${desc}`);
|
||||
}
|
||||
// Do not forget to close the file once you're done
|
||||
zip.close();
|
||||
});
|
||||
```
|
||||
|
||||
Stream one entry to stdout
|
||||
```javascript
|
||||
zip.on('ready', () => {
|
||||
zip.stream('path/inside/zip.txt', (err, stm) => {
|
||||
stm.pipe(process.stdout);
|
||||
stm.on('end', () => zip.close());
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
Extract one file to disk
|
||||
```javascript
|
||||
zip.on('ready', () => {
|
||||
zip.extract('path/inside/zip.txt', './extracted.txt', err => {
|
||||
console.log(err ? 'Extract error' : 'Extracted');
|
||||
zip.close();
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
Extract a folder from archive to disk
|
||||
```javascript
|
||||
zip.on('ready', () => {
|
||||
fs.mkdirSync('extracted');
|
||||
zip.extract('path/inside/zip/', './extracted', err => {
|
||||
console.log(err ? 'Extract error' : 'Extracted');
|
||||
zip.close();
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
Extract everything
|
||||
```javascript
|
||||
zip.on('ready', () => {
|
||||
fs.mkdirSync('extracted');
|
||||
zip.extract(null, './extracted', (err, count) => {
|
||||
console.log(err ? 'Extract error' : `Extracted ${count} entries`);
|
||||
zip.close();
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
Read a file as buffer in sync way
|
||||
```javascript
|
||||
zip.on('ready', () => {
|
||||
const data = zip.entryDataSync('path/inside/zip.txt');
|
||||
zip.close();
|
||||
});
|
||||
```
|
||||
|
||||
When extracting a folder, you can listen to `extract` event
|
||||
```javascript
|
||||
zip.on('extract', (entry, file) => {
|
||||
console.log(`Extracted ${entry.name} to ${file}`);
|
||||
});
|
||||
```
|
||||
|
||||
`entry` event is generated for every entry during loading
|
||||
```javascript
|
||||
zip.on('entry', entry => {
|
||||
// you can already stream this entry,
|
||||
// without waiting until all entry descriptions are read (suitable for very large archives)
|
||||
console.log(`Read entry ${entry.name}`);
|
||||
});
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
You can pass these options to the constructor
|
||||
- `storeEntries: true` - you will be able to work with entries inside zip archive, otherwise the only way to access them is `entry` event
|
||||
- `skipEntryNameValidation: true` - by default, entry name is checked for malicious characters, like `../` or `c:\123`, pass this flag to disable validation errors
|
||||
|
||||
## Methods
|
||||
|
||||
- `zip.entries()` - get all entries description
|
||||
- `zip.entry(name)` - get entry description by name
|
||||
- `zip.stream(entry, function(err, stm) { })` - get entry data reader stream
|
||||
- `zip.entryDataSync(entry)` - get entry data in sync way
|
||||
- `zip.close()` - cleanup after all entries have been read, streamed, extracted, and you don't need the archive
|
||||
|
||||
## Building
|
||||
|
||||
The project doesn't require building. To run unit tests with [nodeunit](https://github.com/caolan/nodeunit):
|
||||
```sh
|
||||
npm test
|
||||
```
|
||||
|
||||
## Known issues
|
||||
|
||||
- [utf8](https://github.com/rubyzip/rubyzip/wiki/Files-with-non-ascii-filenames) file names
|
||||
- AES encrypted files
|
||||
|
||||
## Contributors
|
||||
|
||||
ZIP parsing code has been partially forked from [cthackers/adm-zip](https://github.com/cthackers/adm-zip) (MIT license).
|
193
node_modules/node-stream-zip/node_stream_zip.d.ts
generated
vendored
Normal file
193
node_modules/node-stream-zip/node_stream_zip.d.ts
generated
vendored
Normal file
@ -0,0 +1,193 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
declare namespace StreamZip {
|
||||
interface StreamZipOptions {
|
||||
/**
|
||||
* File to read
|
||||
* @default undefined
|
||||
*/
|
||||
file?: string;
|
||||
|
||||
/**
|
||||
* Alternatively, you can pass fd here
|
||||
* @default undefined
|
||||
*/
|
||||
fd?: number;
|
||||
|
||||
/**
|
||||
* You will be able to work with entries inside zip archive,
|
||||
* otherwise the only way to access them is entry event
|
||||
* @default true
|
||||
*/
|
||||
storeEntries?: boolean;
|
||||
|
||||
/**
|
||||
* By default, entry name is checked for malicious characters, like ../ or c:\123,
|
||||
* pass this flag to disable validation error
|
||||
* @default false
|
||||
*/
|
||||
skipEntryNameValidation?: boolean;
|
||||
|
||||
/**
|
||||
* Filesystem read chunk size
|
||||
* @default automatic based on file size
|
||||
*/
|
||||
chunkSize?: number;
|
||||
}
|
||||
|
||||
interface ZipEntry {
|
||||
/**
|
||||
* file name
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* true if it's a directory entry
|
||||
*/
|
||||
isDirectory: boolean;
|
||||
|
||||
/**
|
||||
* true if it's a file entry, see also isDirectory
|
||||
*/
|
||||
isFile: boolean;
|
||||
|
||||
/**
|
||||
* file comment
|
||||
*/
|
||||
comment: string;
|
||||
|
||||
/**
|
||||
* if the file is encrypted
|
||||
*/
|
||||
encrypted: boolean;
|
||||
|
||||
/**
|
||||
* version made by
|
||||
*/
|
||||
verMade: number;
|
||||
|
||||
/**
|
||||
* version needed to extract
|
||||
*/
|
||||
version: number;
|
||||
|
||||
/**
|
||||
* encrypt, decrypt flags
|
||||
*/
|
||||
flags: number;
|
||||
|
||||
/**
|
||||
* compression method
|
||||
*/
|
||||
method: number;
|
||||
|
||||
/**
|
||||
* modification time
|
||||
*/
|
||||
time: number;
|
||||
|
||||
/**
|
||||
* uncompressed file crc-32 value
|
||||
*/
|
||||
crc: number;
|
||||
|
||||
/**
|
||||
* compressed size
|
||||
*/
|
||||
compressedSize: number;
|
||||
|
||||
/**
|
||||
* uncompressed size
|
||||
*/
|
||||
size: number;
|
||||
|
||||
/**
|
||||
* volume number start
|
||||
*/
|
||||
diskStart: number;
|
||||
|
||||
/**
|
||||
* internal file attributes
|
||||
*/
|
||||
inattr: number;
|
||||
|
||||
/**
|
||||
* external file attributes
|
||||
*/
|
||||
attr: number;
|
||||
|
||||
/**
|
||||
* LOC header offset
|
||||
*/
|
||||
offset: number;
|
||||
}
|
||||
}
|
||||
|
||||
type StreamZipOptions = StreamZip.StreamZipOptions;
|
||||
type ZipEntry = StreamZip.ZipEntry;
|
||||
|
||||
declare class StreamZipAsync {
|
||||
constructor(config: StreamZipOptions);
|
||||
|
||||
entriesCount: Promise<number>;
|
||||
comment: Promise<string>;
|
||||
|
||||
entry(name: string): Promise<ZipEntry | undefined>;
|
||||
entries(): Promise<{ [name: string]: ZipEntry }>;
|
||||
entryData(entry: string | ZipEntry): Promise<Buffer>;
|
||||
stream(entry: string | ZipEntry): Promise<NodeJS.ReadableStream>;
|
||||
extract(entry: string | ZipEntry | null, outPath: string): Promise<number | undefined>;
|
||||
|
||||
on(event: 'entry', handler: (entry: ZipEntry) => void): void;
|
||||
on(event: 'extract', handler: (entry: ZipEntry, outPath: string) => void): void;
|
||||
|
||||
close(): Promise<void>;
|
||||
}
|
||||
|
||||
declare class StreamZip {
|
||||
constructor(config: StreamZipOptions);
|
||||
|
||||
/**
|
||||
* number of entries in the archive
|
||||
*/
|
||||
entriesCount: number;
|
||||
|
||||
/**
|
||||
* archive comment
|
||||
*/
|
||||
comment: string;
|
||||
|
||||
on(event: 'error', handler: (error: any) => void): void;
|
||||
on(event: 'entry', handler: (entry: ZipEntry) => void): void;
|
||||
on(event: 'ready', handler: () => void): void;
|
||||
on(event: 'extract', handler: (entry: ZipEntry, outPath: string) => void): void;
|
||||
|
||||
entry(name: string): ZipEntry | undefined;
|
||||
|
||||
entries(): { [name: string]: ZipEntry };
|
||||
|
||||
stream(
|
||||
entry: string | ZipEntry,
|
||||
callback: (err: any | null, stream?: NodeJS.ReadableStream) => void
|
||||
): void;
|
||||
|
||||
entryDataSync(entry: string | ZipEntry): Buffer;
|
||||
|
||||
openEntry(
|
||||
entry: string | ZipEntry,
|
||||
callback: (err: any | null, entry?: ZipEntry) => void,
|
||||
sync: boolean
|
||||
): void;
|
||||
|
||||
extract(
|
||||
entry: string | ZipEntry | null,
|
||||
outPath: string,
|
||||
callback: (err?: any, res?: number) => void
|
||||
): void;
|
||||
|
||||
close(callback?: (err?: any) => void): void;
|
||||
|
||||
static async: typeof StreamZipAsync;
|
||||
}
|
||||
|
||||
export = StreamZip;
|
1206
node_modules/node-stream-zip/node_stream_zip.js
generated
vendored
Normal file
1206
node_modules/node-stream-zip/node_stream_zip.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
43
node_modules/node-stream-zip/package.json
generated
vendored
Normal file
43
node_modules/node-stream-zip/package.json
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "node-stream-zip",
|
||||
"version": "1.13.3",
|
||||
"description": "node.js library for reading and extraction of ZIP archives",
|
||||
"keywords": [
|
||||
"zip",
|
||||
"archive",
|
||||
"unzip",
|
||||
"stream"
|
||||
],
|
||||
"homepage": "https://github.com/antelle/node-stream-zip",
|
||||
"author": "Antelle <antelle.net@gmail.com> (https://github.com/antelle)",
|
||||
"bugs": {
|
||||
"email": "antelle.net@gmail.com",
|
||||
"url": "https://github.com/antelle/node-stream-zip/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"node_stream_zip.js",
|
||||
"node_stream_zip.d.ts"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint node_stream_zip.js test/tests.js",
|
||||
"check-types": "tsc node_stream_zip.d.ts",
|
||||
"test": "nodeunit test/tests.js"
|
||||
},
|
||||
"main": "node_stream_zip.js",
|
||||
"types": "node_stream_zip.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/antelle/node-stream-zip.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.14.6",
|
||||
"eslint": "^7.19.0",
|
||||
"nodeunit": "^0.11.3",
|
||||
"prettier": "^2.2.1"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user