@mikestools/usefilesystem 0.0.1 → 0.0.2

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.
package/dist/index.d.ts CHANGED
@@ -1,15 +1,4 @@
1
1
  import { ComputedRef } from 'vue';
2
- import { Ref } from 'vue';
3
-
4
- /**
5
- * Compresses data using DEFLATE (native CompressionStream).
6
- */
7
- export declare function compress(data: Uint8Array): Promise<Uint8Array>;
8
-
9
- /**
10
- * Computes CRC-32 checksum for data.
11
- */
12
- export declare function computeCrc32(data: Uint8Array): number;
13
2
 
14
3
  /**
15
4
  * Options for copying files.
@@ -83,33 +72,6 @@ export declare function createFileSystem(): {
83
72
  }>) => void;
84
73
  };
85
74
 
86
- /**
87
- * Creates a ZIP archive from files.
88
- *
89
- * @example
90
- * ```ts
91
- * const zipBlob = await createZip([
92
- * { path: 'readme.txt', content: 'Hello World!' },
93
- * { path: 'data/config.json', content: JSON.stringify({ enabled: true }) },
94
- * { path: 'images/logo.png', content: pngBytes }
95
- * ])
96
- * ```
97
- */
98
- export declare function createZip(files: readonly ZipInput[], options?: CreateZipOptions): Promise<Blob>;
99
-
100
- /**
101
- * Options for creating a ZIP archive.
102
- */
103
- export declare interface CreateZipOptions extends ZipCompressionOptions {
104
- /** Comment to include in the ZIP archive */
105
- readonly comment?: string;
106
- }
107
-
108
- /**
109
- * Decompresses DEFLATE data (native DecompressionStream).
110
- */
111
- export declare function decompress(data: Uint8Array): Promise<Uint8Array>;
112
-
113
75
  /**
114
76
  * Directory entry for listing.
115
77
  */
@@ -129,42 +91,6 @@ export declare interface DirectoryMetadata {
129
91
  readonly createdAt: number;
130
92
  }
131
93
 
132
- /**
133
- * Downloads data as a ZIP file.
134
- */
135
- export declare function downloadAsZip(files: readonly ZipInput[], fileName: string, options?: CreateZipOptions): Promise<void>;
136
-
137
- /**
138
- * Downloads a blob as a file.
139
- */
140
- export declare function downloadBlob(blob: Blob, fileName: string): void;
141
-
142
- /**
143
- * Extracts a single file from a ZIP archive.
144
- */
145
- export declare function extractFile(zipData: Uint8Array | Blob, filePath: string): Promise<Uint8Array | undefined>;
146
-
147
- /**
148
- * Extracts all files from a ZIP archive.
149
- *
150
- * @example
151
- * ```ts
152
- * const entries = await extractZip(zipBlob)
153
- * for (const entry of entries) {
154
- * console.log(entry.path, entry.content.length)
155
- * }
156
- * ```
157
- */
158
- export declare function extractZip(zipData: Uint8Array | Blob, options?: ExtractZipOptions): Promise<readonly ZipEntry[]>;
159
-
160
- /**
161
- * Options for extracting from a ZIP archive.
162
- */
163
- export declare interface ExtractZipOptions {
164
- /** Filter function to select which entries to extract */
165
- readonly filter?: (entry: ZipEntryMetadata) => boolean;
166
- }
167
-
168
94
  /**
169
95
  * Represents file metadata without content.
170
96
  */
@@ -215,11 +141,6 @@ export declare interface ListOptions {
215
141
  readonly directoriesOnly?: boolean;
216
142
  }
217
143
 
218
- /**
219
- * Reads entries from a ZIP archive without extracting content.
220
- */
221
- export declare function listZip(zipData: Uint8Array | Blob): Promise<readonly ZipEntryMetadata[]>;
222
-
223
144
  /**
224
145
  * Options for moving files.
225
146
  */
@@ -286,67 +207,6 @@ export declare interface UseFileSystemReturn extends FileSystem_2 {
286
207
  restore: () => Promise<void>;
287
208
  }
288
209
 
289
- /**
290
- * Vue composable for ZIP operations with reactive state.
291
- *
292
- * @example
293
- * ```ts
294
- * const zip = useZip()
295
- *
296
- * // Create and download a ZIP
297
- * await zip.download([
298
- * { path: 'readme.txt', content: 'Hello!' },
299
- * { path: 'data.json', content: JSON.stringify({ foo: 'bar' }) }
300
- * ], 'archive.zip')
301
- *
302
- * // Extract a ZIP file
303
- * const entries = await zip.extract(zipBlob)
304
- * for (const entry of entries) {
305
- * console.log(entry.path, new TextDecoder().decode(entry.content))
306
- * }
307
- *
308
- * // Check processing state
309
- * if (zip.isProcessing.value) {
310
- * console.log(`Progress: ${zip.progress.value}%`)
311
- * }
312
- * ```
313
- */
314
- export declare function useZip(): UseZipReturn;
315
-
316
- /**
317
- * Return type for useZip composable.
318
- */
319
- export declare interface UseZipReturn {
320
- /** Current operation state */
321
- readonly state: ComputedRef<ZipOperationState>;
322
- /** Whether an operation is in progress */
323
- readonly isProcessing: Ref<boolean>;
324
- /** Progress percentage (0-100) */
325
- readonly progress: Ref<number>;
326
- /** Last error message */
327
- readonly error: Ref<string | undefined>;
328
- /** Create a ZIP archive from files */
329
- create: (files: readonly ZipInput[], options?: CreateZipOptions) => Promise<Blob>;
330
- /** Extract all files from a ZIP archive */
331
- extract: (zipData: Uint8Array | Blob, options?: ExtractZipOptions) => Promise<readonly ZipEntry[]>;
332
- /** Extract a single file from a ZIP archive */
333
- extractSingle: (zipData: Uint8Array | Blob, filePath: string) => Promise<Uint8Array | undefined>;
334
- /** List entries in a ZIP archive without extracting */
335
- list: (zipData: Uint8Array | Blob) => Promise<readonly ZipEntryMetadata[]>;
336
- /** Download a ZIP archive */
337
- download: (files: readonly ZipInput[], fileName: string, options?: CreateZipOptions) => Promise<void>;
338
- /** Download a blob as a file */
339
- downloadBlob: (blob: Blob, fileName: string) => void;
340
- /** Compress data using DEFLATE */
341
- compress: (data: Uint8Array) => Promise<Uint8Array>;
342
- /** Decompress DEFLATE data */
343
- decompress: (data: Uint8Array) => Promise<Uint8Array>;
344
- /** Compute CRC-32 checksum */
345
- computeCrc32: (data: Uint8Array) => number;
346
- /** Reset error state */
347
- clearError: () => void;
348
- }
349
-
350
210
  /**
351
211
  * Represents a complete file with content.
352
212
  */
@@ -362,64 +222,4 @@ export declare interface WriteFileOptions {
362
222
  readonly overwrite?: boolean;
363
223
  }
364
224
 
365
- /**
366
- * Options for ZIP compression.
367
- */
368
- export declare interface ZipCompressionOptions {
369
- /** Compression level: 'none' stores files, 'fast'/'default' uses deflate */
370
- readonly level?: 'none' | 'fast' | 'default';
371
- }
372
-
373
- /**
374
- * Represents an entry in a ZIP archive.
375
- */
376
- export declare interface ZipEntry {
377
- readonly path: string;
378
- readonly content: Uint8Array;
379
- readonly compressedSize: number;
380
- readonly uncompressedSize: number;
381
- readonly compressionMethod: 'store' | 'deflate';
382
- readonly crc32: number;
383
- readonly modifiedAt: Date;
384
- readonly isDirectory: boolean;
385
- }
386
-
387
- /**
388
- * Metadata for a ZIP entry (without content).
389
- */
390
- export declare interface ZipEntryMetadata {
391
- readonly path: string;
392
- readonly compressedSize: number;
393
- readonly uncompressedSize: number;
394
- readonly compressionMethod: 'store' | 'deflate';
395
- readonly isDirectory: boolean;
396
- readonly modifiedAt: Date;
397
- }
398
-
399
- /**
400
- * Input for adding files to a ZIP archive.
401
- */
402
- export declare interface ZipInput {
403
- readonly path: string;
404
- readonly content: Uint8Array | string;
405
- }
406
-
407
- /**
408
- * State for ZIP operations.
409
- */
410
- export declare interface ZipOperationState {
411
- readonly isProcessing: boolean;
412
- readonly progress: number;
413
- readonly error: string | undefined;
414
- }
415
-
416
- /**
417
- * Result of a ZIP operation.
418
- */
419
- export declare interface ZipResult<T = void> {
420
- readonly success: boolean;
421
- readonly data?: T;
422
- readonly error?: string;
423
- }
424
-
425
225
  export { }