Gathering detailed insights and metrics for @tokenizer/inflate
Gathering detailed insights and metrics for @tokenizer/inflate
Gathering detailed insights and metrics for @tokenizer/inflate
Gathering detailed insights and metrics for @tokenizer/inflate
A package designed for handling and extracting data from ZIP files efficiently using a tokenizer-based approach. The library provides a customizable way to parse ZIP archives and extract compressed data while minimizing memory usage.
npm install @tokenizer/inflate
Typescript
Module System
Min. Node Version
Node Version
NPM Version
98.9
Supply Chain
98.1
Quality
85
Maintenance
100
Vulnerability
100
License
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
86 Commits
1 Watchers
10 Branches
1 Contributors
Updated on Jun 08, 2025
Latest Version
0.3.1
Package Id
@tokenizer/inflate@0.3.1
Unpacked Size
27.95 kB
Size
7.51 kB
File Count
11
NPM Version
11.3.0
Node Version
22.13.0
Published on
Jun 08, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
@tokenizer/inflate
is a package designed for handling and extracting data from ZIP files efficiently using a tokenizer-based approach.
The library provides a customizable way to parse ZIP archives and extract compressed data while minimizing memory usage.
1npm install @tokenizer/inflate
The following example demonstrates how to use the library to extract .txt files and stop processing when encountering a .stop file.
1import { ZipHandler } from '@tokenizer/inflate'; 2import { fromFile } from 'strtok3'; 3 4const fileFilter = (file) => { 5 console.log(`Processing file: ${file.filename}`); 6 7 if (file.filename?.endsWith(".stop")) { 8 console.log(`Stopping processing due to file: ${file.filename}`); 9 return { handler: false, stop: true }; // Stop the unzip process 10 } 11 12 if (file.filename?.endsWith(".txt")) { 13 return { 14 handler: async (data) => { 15 console.log(`Extracted text file: ${file.filename}`); 16 console.log(new TextDecoder().decode(data)); 17 }, 18 }; 19 } 20 21 return { handler: false }; // Ignore other files 22}; 23 24async function extractFiles(zipFilePath) { 25 const tokenizer = await fromFile(zipFilePath); 26 const zipHandler = new ZipHandler(tokenizer); 27 await zipHandler.unzip(fileFilter); 28} 29 30extractFiles('example.zip').catch(console.error);
ZipHandler
A class for handling ZIP file parsing and extraction.
1new ZipHandler(tokenizer: ITokenizer)
isZip(): Promise<boolean>
Determines whether the input file is a ZIP archive.
unzip(fileCb: InflateFileFilter): Promise<void>
Extracts files from the ZIP archive, applying the provided InflateFileFilter
callback to each file.
InflatedDataHandler
InflateFileFilter
1type InflateFileFilter = (file: IFullZipHeader) => InflateFileFilterResult;
Callback function to determine whether a file should be handled or ignored.
InflateFileFilterResult
1type InflateFileFilterResult = { 2 handler: InflatedDataHandler | false; // Handle file data or ignore 3 stop?: boolean; // Stop processing further files 4}; 5
Returned from InflateFileFilter
to control file handling and extraction flow.
InflatedDataHandler
1type InflatedDataHandler = (fileData: Uint8Array) => Promise<void>;
Handler for processing uncompressed file data.
This module is a pure ECMAScript Module (ESM). The distributed JavaScript codebase is compliant with the ECMAScript 2020 (11th Edition) standard. If used with Node.js, it requires version ≥ 18.
This project is licensed under the MIT License. See the LICENSE file for details.
No vulnerabilities found.
No security vulnerabilities found.