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
80.5
Maintenance
100
Vulnerability
100
License
TypeScript (100%)
Total Downloads
5,900,676
Last Day
87,668
Last Week
1,483,969
Last Month
4,515,358
Last Year
5,900,676
MIT License
69 Commits
1 Watchers
8 Branches
1 Contributors
Updated on Apr 24, 2025
Latest Version
0.2.7
Package Id
@tokenizer/inflate@0.2.7
Unpacked Size
25.76 kB
Size
7.00 kB
File Count
7
NPM Version
10.9.2
Node Version
23.7.0
Published on
Feb 23, 2025
Cumulative downloads
Total Downloads
Last Day
15%
87,668
Compared to previous day
Last Week
21.6%
1,483,969
Compared to previous week
Last Month
529.6%
4,515,358
Compared to previous month
Last Year
0%
5,900,676
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.