@push.rocks/smartarchive 5.0.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -100,17 +100,14 @@ export class ZipCompressionStream extends plugins.stream.Duplex {
100
100
  filesObj[name] = options ? [data, options] : data;
101
101
  }
102
102
 
103
- return new Promise((resolve, reject) => {
104
- plugins.fflate.zip(filesObj, (err, result) => {
105
- if (err) {
106
- reject(err);
107
- } else {
108
- this.push(Buffer.from(result));
109
- this.push(null);
110
- resolve();
111
- }
112
- });
113
- });
103
+ // Use sync version for Deno compatibility (fflate async uses Web Workers)
104
+ try {
105
+ const result = plugins.fflate.zipSync(filesObj);
106
+ this.push(Buffer.from(result));
107
+ this.push(null);
108
+ } catch (err) {
109
+ throw err;
110
+ }
114
111
  }
115
112
 
116
113
  _read(): void {
@@ -179,31 +176,21 @@ export class ZipTools {
179
176
  }
180
177
  }
181
178
 
182
- return new Promise((resolve, reject) => {
183
- plugins.fflate.zip(filesObj, (err, result) => {
184
- if (err) reject(err);
185
- else resolve(Buffer.from(result));
186
- });
187
- });
179
+ // Use sync version for Deno compatibility (fflate async uses Web Workers)
180
+ const result = plugins.fflate.zipSync(filesObj);
181
+ return Buffer.from(result);
188
182
  }
189
183
 
190
184
  /**
191
185
  * Extract a ZIP buffer to an array of entries
192
186
  */
193
187
  public async extractZip(data: Buffer): Promise<Array<{ path: string; content: Buffer }>> {
194
- return new Promise((resolve, reject) => {
195
- plugins.fflate.unzip(data, (err, result) => {
196
- if (err) {
197
- reject(err);
198
- return;
199
- }
200
-
201
- const entries: Array<{ path: string; content: Buffer }> = [];
202
- for (const [path, content] of Object.entries(result)) {
203
- entries.push({ path, content: Buffer.from(content) });
204
- }
205
- resolve(entries);
206
- });
207
- });
188
+ // Use sync version for Deno compatibility (fflate async uses Web Workers)
189
+ const result = plugins.fflate.unzipSync(data);
190
+ const entries: Array<{ path: string; content: Buffer }> = [];
191
+ for (const [path, content] of Object.entries(result)) {
192
+ entries.push({ path, content: Buffer.from(content) });
193
+ }
194
+ return entries;
208
195
  }
209
196
  }
package/ts/interfaces.ts CHANGED
@@ -129,3 +129,8 @@ export interface IHuffmanGroup {
129
129
  minLen: number;
130
130
  maxLen: number;
131
131
  }
132
+
133
+ /**
134
+ * Entry filter predicate for fluent API
135
+ */
136
+ export type TEntryFilter = (entry: IArchiveEntryInfo) => boolean;