opfs-worker 1.0.1 → 1.2.0

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/worker.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import type { DirentData, Encoding, FileStat, OPFSOptions, RenameOptions, WatchOptions } from './types';
2
- import type { BufferEncoding } from 'typescript';
1
+ import type { DirentData, FileOpenOptions, FileStat, OPFSOptions, RenameOptions, WatchOptions } from './types';
3
2
  /**
4
3
  * OPFS (Origin Private File System) File System implementation
5
4
  *
@@ -26,6 +25,15 @@ export declare class OPFSWorker {
26
25
  private broadcastChannel;
27
26
  /** Configuration options */
28
27
  private options;
28
+ /** Map of open file descriptors to their metadata */
29
+ private openFiles;
30
+ /** Next available file descriptor number */
31
+ private nextFd;
32
+ /**
33
+ * Get file info by descriptor with validation
34
+ * @private
35
+ */
36
+ private _getFileDescriptor;
29
37
  /**
30
38
  * Notify about internal changes to the file system
31
39
  *
@@ -142,79 +150,69 @@ export declare class OPFSWorker {
142
150
  /**
143
151
  * Read a file from the file system
144
152
  *
145
- * Reads the contents of a file and returns it as a string or binary data
146
- * depending on the specified encoding.
153
+ * Reads the contents of a file and returns it as binary data.
147
154
  *
148
155
  * @param path - The path to the file to read
149
- * @param encoding - The encoding to use for reading the file
150
- * @returns Promise that resolves to the file contents
156
+ * @returns Promise that resolves to the file contents as Uint8Array
151
157
  * @throws {FileNotFoundError} If the file does not exist
152
158
  * @throws {OPFSError} If reading the file fails
153
159
  *
154
160
  * @example
155
161
  * ```typescript
156
- * // Read as text
162
+ * // Read as binary data
157
163
  * const content = await fs.readFile('/config/settings.json');
158
164
  *
159
- * // Read as binary
160
- * const binaryData = await fs.readFile('/images/logo.png', 'binary');
161
- *
162
- * // Read with specific encoding
163
- * const utf8Content = await fs.readFile('/data/utf8.txt', 'utf-8');
165
+ * // Read binary file
166
+ * const binaryData = await fs.readFile('/images/logo.png');
164
167
  * ```
165
168
  */
166
- readFile(path: string, encoding: 'binary'): Promise<Uint8Array>;
167
- readFile(path: string, encoding: Encoding): Promise<string>;
168
- readFile(path: string, encoding: Encoding | 'binary'): Promise<string | Uint8Array>;
169
+ readFile(path: string): Promise<Uint8Array>;
169
170
  /**
170
171
  * Write data to a file
171
172
  *
172
- * Creates or overwrites a file with the specified data. If the file already
173
+ * Creates or overwrites a file with the specified binary data. If the file already
173
174
  * exists, it will be truncated before writing.
174
175
  *
175
176
  * @param path - The path to the file to write
176
- * @param data - The data to write to the file (string, Uint8Array, or ArrayBuffer)
177
- * @param encoding - The encoding to use when writing string data (default: 'utf-8')
177
+ * @param data - The binary data to write to the file (Uint8Array or ArrayBuffer)
178
178
  * @returns Promise that resolves when the write operation is complete
179
179
  * @throws {OPFSError} If writing the file fails
180
180
  *
181
181
  * @example
182
182
  * ```typescript
183
- * // Write text data
184
- * await fs.writeFile('/config/settings.json', JSON.stringify({ theme: 'dark' }));
185
- *
186
183
  * // Write binary data
187
184
  * const binaryData = new Uint8Array([1, 2, 3, 4, 5]);
188
185
  * await fs.writeFile('/data/binary.dat', binaryData);
189
186
  *
190
- * // Write with specific encoding
191
- * await fs.writeFile('/data/utf16.txt', 'Hello World', 'utf-16le');
187
+ * // Write from ArrayBuffer
188
+ * const arrayBuffer = new ArrayBuffer(10);
189
+ * await fs.writeFile('/data/buffer.dat', arrayBuffer);
192
190
  * ```
193
191
  */
194
- writeFile(path: string, data: string | Uint8Array | ArrayBuffer, encoding?: BufferEncoding): Promise<void>;
192
+ writeFile(path: string, data: Uint8Array | ArrayBuffer): Promise<void>;
195
193
  /**
196
194
  * Append data to a file
197
195
  *
198
- * Adds data to the end of an existing file. If the file doesn't exist,
196
+ * Adds binary data to the end of an existing file. If the file doesn't exist,
199
197
  * it will be created.
200
198
  *
201
199
  * @param path - The path to the file to append to
202
- * @param data - The data to append to the file (string, Uint8Array, or ArrayBuffer)
203
- * @param encoding - The encoding to use when appending string data (default: 'utf-8')
200
+ * @param data - The binary data to append to the file (Uint8Array or ArrayBuffer)
204
201
  * @returns Promise that resolves when the append operation is complete
205
202
  * @throws {OPFSError} If appending to the file fails
206
203
  *
207
204
  * @example
208
205
  * ```typescript
209
- * // Append text to a log file
210
- * await fs.appendFile('/logs/app.log', `[${new Date().toISOString()}] User logged in\n`);
211
- *
212
206
  * // Append binary data
213
207
  * const additionalData = new Uint8Array([6, 7, 8]);
214
208
  * await fs.appendFile('/data/binary.dat', additionalData);
209
+ *
210
+ * // Append from ArrayBuffer
211
+ * const arrayBuffer = new ArrayBuffer(5);
212
+ * await fs.appendFile('/data/buffer.dat', arrayBuffer);
215
213
  * ```
216
214
  */
217
- appendFile(path: string, data: string | Uint8Array | ArrayBuffer, encoding?: BufferEncoding): Promise<void>;
215
+ appendFile(path: string, data: Uint8Array | ArrayBuffer): Promise<void>;
218
216
  /**
219
217
  * Create a directory
220
218
  *
@@ -445,6 +443,155 @@ export declare class OPFSWorker {
445
443
  * Stop watching a previously watched path
446
444
  */
447
445
  unwatch(path: string): void;
446
+ /**
447
+ * Open a file and return a file descriptor
448
+ *
449
+ * @param path - The path to the file to open
450
+ * @param options - Options for opening the file
451
+ * @param options.create - Whether to create the file if it doesn't exist (default: false)
452
+ * @param options.exclusive - If true and create is true, fails if file already exists (default: false)
453
+ * Note: This is best-effort in OPFS, not fully atomic due to browser limitations
454
+ * @param options.truncate - Whether to truncate the file to zero length (default: false)
455
+ * @returns Promise that resolves to a file descriptor number
456
+ * @throws {OPFSError} If opening the file fails
457
+ *
458
+ * @example
459
+ * ```typescript
460
+ * // Open existing file for reading
461
+ * const fd = await fs.open('/data/config.json');
462
+ *
463
+ * // Create new file for writing
464
+ * const fd = await fs.open('/data/new.txt', { create: true });
465
+ *
466
+ * // Create file exclusively (fails if exists)
467
+ * const fd = await fs.open('/data/unique.txt', { create: true, exclusive: true });
468
+ *
469
+ * // Open and truncate file
470
+ * const fd = await fs.open('/data/log.txt', { create: true, truncate: true });
471
+ * ```
472
+ */
473
+ open(path: string, options?: FileOpenOptions): Promise<number>;
474
+ /**
475
+ * Internal method to open a file (without locking)
476
+ * @private
477
+ */
478
+ private _openFile;
479
+ /**
480
+ * Close a file descriptor
481
+ *
482
+ * @param fd - The file descriptor to close
483
+ * @returns Promise that resolves when the file descriptor is closed
484
+ * @throws {OPFSError} If the file descriptor is invalid or closing fails
485
+ *
486
+ * @example
487
+ * ```typescript
488
+ * const fd = await fs.open('/data/file.txt');
489
+ * // ... use the file descriptor ...
490
+ * await fs.close(fd);
491
+ * ```
492
+ */
493
+ close(fd: number): Promise<void>;
494
+ /**
495
+ * Read data from a file descriptor
496
+ *
497
+ * @param fd - The file descriptor to read from
498
+ * @param buffer - The buffer to read data into
499
+ * @param offset - The offset in the buffer to start writing at
500
+ * @param length - The number of bytes to read
501
+ * @param position - The position in the file to read from (null for current position)
502
+ * @returns Promise that resolves to the number of bytes read and the modified buffer
503
+ * @throws {OPFSError} If the file descriptor is invalid or reading fails
504
+ *
505
+ * @note This method uses Comlink.transfer() to efficiently pass the buffer as a Transferable Object,
506
+ * ensuring zero-copy performance across Web Worker boundaries.
507
+ *
508
+ * @example
509
+ * ```typescript
510
+ * const fd = await fs.open('/data/file.txt');
511
+ * const buffer = new Uint8Array(1024);
512
+ * const { bytesRead, buffer: modifiedBuffer } = await fs.read(fd, buffer, 0, 1024, null);
513
+ * console.log(`Read ${bytesRead} bytes`);
514
+ * // Use modifiedBuffer which contains the actual data
515
+ * await fs.close(fd);
516
+ * ```
517
+ */
518
+ read(fd: number, buffer: Uint8Array, offset: number, length: number, position: number | null | undefined): Promise<{
519
+ bytesRead: number;
520
+ buffer: Uint8Array;
521
+ }>;
522
+ /**
523
+ * Write data to a file descriptor
524
+ *
525
+ * @param fd - The file descriptor to write to
526
+ * @param buffer - The buffer containing data to write
527
+ * @param offset - The offset in the buffer to start reading from (default: 0)
528
+ * @param length - The number of bytes to write (default: entire buffer)
529
+ * @param position - The position in the file to write to (null/undefined for current position)
530
+ * @param emitEvent - Whether to emit a change event (default: true)
531
+ * @returns Promise that resolves to the number of bytes written
532
+ * @throws {OPFSError} If the file descriptor is invalid or writing fails
533
+ *
534
+ * @example
535
+ * ```typescript
536
+ * const fd = await fs.open('/data/file.txt', { create: true });
537
+ * const data = new TextEncoder().encode('Hello, World!');
538
+ * const bytesWritten = await fs.write(fd, data, 0, data.length, null);
539
+ * console.log(`Wrote ${bytesWritten} bytes`);
540
+ * await fs.close(fd);
541
+ * ```
542
+ */
543
+ write(fd: number, buffer: Uint8Array, offset?: number, length?: number, position?: number | null | undefined, emitEvent?: boolean): Promise<number>;
544
+ /**
545
+ * Get file status information by file descriptor
546
+ *
547
+ * @param fd - The file descriptor
548
+ * @returns Promise that resolves to FileStat object
549
+ * @throws {OPFSError} If the file descriptor is invalid
550
+ *
551
+ * @example
552
+ * ```typescript
553
+ * const fd = await fs.open('/data/file.txt');
554
+ * const stats = await fs.fstat(fd);
555
+ * console.log(`File size: ${stats.size} bytes`);
556
+ * console.log(`Last modified: ${stats.mtime}`);
557
+ *
558
+ * // If hashing is enabled, hash will be included
559
+ * if (stats.hash) {
560
+ * console.log(`Hash: ${stats.hash}`);
561
+ * }
562
+ * ```
563
+ */
564
+ fstat(fd: number): Promise<FileStat>;
565
+ /**
566
+ * Truncate file to specified size
567
+ *
568
+ * @param fd - The file descriptor
569
+ * @param size - The new size of the file (default: 0)
570
+ * @returns Promise that resolves when truncation is complete
571
+ * @throws {OPFSError} If the file descriptor is invalid or truncation fails
572
+ *
573
+ * @example
574
+ * ```typescript
575
+ * const fd = await fs.open('/data/file.txt', { create: true });
576
+ * await fs.truncate(fd, 100); // Truncate to 100 bytes
577
+ * ```
578
+ */
579
+ ftruncate(fd: number, size?: number): Promise<void>;
580
+ /**
581
+ * Synchronize file data to storage (fsync equivalent)
582
+ *
583
+ * @param fd - The file descriptor
584
+ * @returns Promise that resolves when synchronization is complete
585
+ * @throws {OPFSError} If the file descriptor is invalid or sync fails
586
+ *
587
+ * @example
588
+ * ```typescript
589
+ * const fd = await fs.open('/data/file.txt', { create: true });
590
+ * await fs.write(fd, data);
591
+ * await fs.fsync(fd); // Ensure data is written to storage
592
+ * ```
593
+ */
594
+ fsync(fd: number): Promise<void>;
448
595
  /**
449
596
  * Dispose of resources and clean up the file system instance
450
597
  *
@@ -1 +1 @@
1
- {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAc,YAAY,EAAiB,MAAM,SAAS,CAAC;AACnI,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,UAAU;IACnB,gDAAgD;IAChD,OAAO,CAAC,IAAI,CAA6B;IAEzC,uCAAuC;IACvC,OAAO,CAAC,QAAQ,CAAoC;IAEpD,qDAAqD;IACrD,OAAO,CAAC,eAAe,CAAiC;IAExD,mDAAmD;IACnD,OAAO,CAAC,gBAAgB,CAAiC;IAEzD,4BAA4B;IAC5B,OAAO,CAAC,OAAO,CAMb;IAGF;;;;;;;;OAQG;YACW,YAAY;IAmD1B;;;;;;;;;OASG;gBACS,OAAO,CAAC,EAAE,WAAW;IAQjC;;;;;;;;;;;;;;;;;;;;OAoBG;YACW,KAAK;IA6BnB;;;;;;;;;OASG;IACG,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAkCrD;;;;;;;;;;;;;;;;;OAiBG;YACW,kBAAkB;IAWhC;;;;;;;;;;;;;;;;;;OAkBG;YACW,aAAa;IAa3B;;;;;;;;;;;;;;;;;;OAkBG;IACG,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAsC7C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,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;;;;;;;OAaG;IACG,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,GAAE,MAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB5D;;;;;;;;;;;;;OAaG;IACG,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWtC;;;;;OAKG;IACH,OAAO,IAAI,IAAI;IAiBf;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACG,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAqClH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opfs-worker",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
4
  "description": "A robust TypeScript library for working with Origin Private File System (OPFS) through Web Workers",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -25,13 +25,13 @@
25
25
  "scripts": {
26
26
  "build": "vite build && tsc -p tsconfig.build.json",
27
27
  "build:demo": "vite build demo --base=./",
28
- "watch": "concurrently \"vite build --watch\" \"tsc -p tsconfig.build.json --watch\"",
28
+ "watch": "concurrently \"vite build --watch --mode development\" \"tsc -p tsconfig.build.json --watch\"",
29
29
  "dev": "vite serve demo",
30
30
  "preview": "vite preview demo",
31
31
  "type-check": "tsc --noEmit",
32
32
  "lint": "eslint src --ext .ts,.tsx",
33
33
  "lint:fix": "eslint src --ext .ts,.tsx --fix",
34
- "test": "vitest",
34
+ "test": "vitest --run",
35
35
  "test:coverage": "vitest --coverage",
36
36
  "prepublishOnly": "npm run build",
37
37
  "version": "changeset && changeset version",