opfs-worker 1.1.0 → 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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["import { wrap } from 'comlink';\n\nimport WorkerCtor from './worker?worker&inline';\n\nimport type { OPFSOptions, OPFSWorker, RemoteOPFSWorker } from './types';\n\nexport * from './types';\nexport * from './utils/errors';\nexport * from './utils/helpers';\nexport * from './utils/encoder';\n\n/**\n * Creates a new file system instance with inline worker\n * @param options - Optional configuration options\n * @returns Promise resolving to the file system interface\n */\nexport async function createWorker(\n options?: OPFSOptions\n): Promise<RemoteOPFSWorker> {\n const wrapped = wrap<OPFSWorker>(new WorkerCtor());\n\n // Set up options if provided\n if (options) {\n // We can't pass a BroadcastChannel instance to the worker, so we need to convert it to a string first\n if (options.broadcastChannel && options.broadcastChannel instanceof BroadcastChannel) {\n options.broadcastChannel = options.broadcastChannel.name;\n }\n\n await wrapped.setOptions(options);\n }\n\n return wrapped;\n}\n"],"names":["createWorker","options","wrapped","wrap","WorkerCtor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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BA,EAClBC,EACyB,CACzB,MAAMC,EAAUC,EAAAA,KAAiB,IAAIC,CAAY,EAGjD,OAAIH,IAEIA,EAAQ,kBAAoBA,EAAQ,4BAA4B,mBAChEA,EAAQ,iBAAmBA,EAAQ,iBAAiB,MAGxD,MAAMC,EAAQ,WAAWD,CAAO,GAG7BC,CACX"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/facade.ts","../src/index.ts"],"sourcesContent":["import { wrap } from 'comlink';\n\nimport { decodeBuffer, encodeString, isBinaryFileExtension } from './utils/encoder';\nimport WorkerCtor from './worker?worker&inline';\n\nimport type {\n DirentData,\n Encoding,\n FileOpenOptions,\n FileStat,\n OPFSOptions,\n RemoteOPFSWorker,\n RenameOptions,\n WatchOptions\n} from './types';\n\n/**\n * Facade class that provides a clean interface for communicating with the OPFS worker\n * while hiding Comlink implementation details.\n */\nexport class OPFSFileSystem {\n #worker: RemoteOPFSWorker;\n\n constructor(options?: OPFSOptions) {\n const wrapped = wrap<RemoteOPFSWorker>(new WorkerCtor());\n\n this.#worker = wrapped;\n\n // Set up options if provided\n if (options) {\n // We can't pass a BroadcastChannel instance to the worker, so we need to convert it to a string first\n if (options.broadcastChannel && options.broadcastChannel instanceof BroadcastChannel) {\n options.broadcastChannel = options.broadcastChannel.name;\n }\n\n // Initialize options asynchronously\n void this.setOptions(options);\n }\n }\n\n /**\n * Update configuration options\n */\n async setOptions(options: OPFSOptions) {\n return this.#worker.setOptions(options);\n }\n\n /**\n * Get a complete index of all files and directories in the file system\n */\n async index(): Promise<Map<string, FileStat>> {\n return this.#worker.index();\n }\n\n /**\n * Read a file from the file system\n */\n async readFile(path: string, encoding: 'binary'): Promise<Uint8Array>;\n async readFile(path: string, encoding: Encoding): Promise<string>;\n async readFile(path: string, encoding?: Encoding | 'binary'): Promise<string | Uint8Array>;\n async readFile(\n path: string,\n encoding?: any\n ): Promise<string | Uint8Array> {\n // Get binary data from worker\n const buffer = await this.#worker.readFile(path);\n\n // If no encoding specified, auto-detect based on file extension\n if (!encoding) {\n encoding = isBinaryFileExtension(path) ? 'binary' : 'utf-8';\n }\n\n // Return binary data or decode to string\n return (encoding === 'binary') ? buffer : decodeBuffer(buffer, encoding);\n }\n\n /**\n * Write data to a file\n */\n async writeFile(\n path: string,\n data: string | Uint8Array | ArrayBuffer,\n encoding?: Encoding\n ): Promise<void> {\n // If no encoding specified, auto-detect based on file extension\n if (!encoding) {\n encoding = (typeof data !== 'string' || isBinaryFileExtension(path)) ? 'binary' : 'utf-8';\n }\n\n // Convert data to Uint8Array\n const buffer = typeof data === 'string'\n ? encodeString(data, encoding)\n : (data instanceof Uint8Array ? data : new Uint8Array(data));\n\n return this.#worker.writeFile(path, buffer);\n }\n\n /**\n * Append data to a file\n */\n async appendFile(\n path: string,\n data: string | Uint8Array | ArrayBuffer,\n encoding?: Encoding\n ): Promise<void> {\n // If no encoding specified, auto-detect based on file extension\n if (!encoding) {\n encoding = (typeof data !== 'string' || isBinaryFileExtension(path)) ? 'binary' : 'utf-8';\n }\n\n // Convert data to Uint8Array\n const buffer = typeof data === 'string'\n ? encodeString(data, encoding)\n : (data instanceof Uint8Array ? data : new Uint8Array(data));\n\n return this.#worker.appendFile(path, buffer);\n }\n\n /**\n * Create a directory\n */\n async mkdir(path: string, options?: { recursive?: boolean }): Promise<void> {\n return this.#worker.mkdir(path, options);\n }\n\n /**\n * Get file or directory statistics\n */\n async stat(path: string): Promise<FileStat> {\n return this.#worker.stat(path);\n }\n\n /**\n * Read a directory's contents\n */\n async readDir(path: string): Promise<DirentData[]> {\n return this.#worker.readDir(path);\n }\n\n /**\n * Check if a file or directory exists\n */\n async exists(path: string): Promise<boolean> {\n return this.#worker.exists(path);\n }\n\n /**\n * Clear all contents of a directory without removing the directory itself\n */\n async clear(path?: string): Promise<void> {\n return this.#worker.clear(path);\n }\n\n /**\n * Remove files and directories\n */\n async remove(path: string, options?: { recursive?: boolean; force?: boolean }): Promise<void> {\n return this.#worker.remove(path, options);\n }\n\n /**\n * Resolve a path to an absolute path\n */\n async realpath(path: string): Promise<string> {\n return this.#worker.realpath(path);\n }\n\n /**\n * Rename a file or directory\n */\n async rename(oldPath: string, newPath: string, options?: RenameOptions): Promise<void> {\n return this.#worker.rename(oldPath, newPath, options);\n }\n\n /**\n * Copy files and directories\n */\n async copy(source: string, destination: string, options?: { recursive?: boolean; overwrite?: boolean }): Promise<void> {\n return this.#worker.copy(source, destination, options);\n }\n\n /**\n * Start watching a file or directory for changes\n */\n watch(path: string, options?: WatchOptions): () => void {\n void this.#worker.watch(path, options);\n\n return () => this.unwatch(path);\n }\n\n /**\n * Stop watching a previously watched path\n */\n unwatch(path: string) {\n void this.#worker.unwatch(path);\n }\n\n /**\n * Open a file and return a file descriptor\n */\n async open(path: string, options?: FileOpenOptions): Promise<number> {\n return this.#worker.open(path, options);\n }\n\n /**\n * Close a file descriptor\n */\n async close(fd: number): Promise<void> {\n return this.#worker.close(fd);\n }\n\n /**\n * Read data from a file descriptor\n * \n * This method requires special handling due to Comlink transfer requirements.\n * The buffer is transferred to the worker and back, so the original buffer\n * becomes unusable after the call.\n */\n async read(\n fd: number,\n buffer: Uint8Array,\n offset: number,\n length: number,\n position?: number | null | undefined\n ): Promise<{ bytesRead: number; buffer: Uint8Array }> {\n const { bytesRead, buffer: transferred } = await this.#worker.read(\n fd,\n // Temp buffer to preserve the original buffer\n new Uint8Array(length),\n 0,\n length,\n position\n );\n\n // Copy the data from the transferred buffer to the original buffer\n if (bytesRead > 0) {\n buffer.set(transferred.subarray(0, bytesRead), offset);\n }\n\n return { bytesRead, buffer };\n }\n\n /**\n * Write data to a file descriptor\n */\n async write(\n fd: number,\n buffer: Uint8Array,\n offset?: number,\n length?: number,\n position?: number | null | undefined,\n emitEvent?: boolean\n ): Promise<number> {\n return this.#worker.write(fd, buffer, offset, length, position, emitEvent);\n }\n\n /**\n * Get file status information by file descriptor\n */\n async fstat(fd: number): Promise<FileStat> {\n return this.#worker.fstat(fd);\n }\n\n /**\n * Truncate file to specified size\n */\n async ftruncate(fd: number, size?: number): Promise<void> {\n return this.#worker.ftruncate(fd, size);\n }\n\n /**\n * Synchronize file data to storage (fsync equivalent)\n */\n async fsync(fd: number): Promise<void> {\n return this.#worker.fsync(fd);\n }\n\n /**\n * Dispose of resources and clean up the file system instance\n */\n dispose() {\n void this.#worker.dispose();\n }\n\n /**\n * Synchronize the file system with external data\n */\n async sync(entries: [string, string | Uint8Array | Blob][], options?: { cleanBefore?: boolean }): Promise<void> {\n return this.#worker.sync(entries, options);\n }\n\n /**\n * Read a file as text with automatic encoding detection\n */\n async readText(path: string, encoding: Encoding = 'utf-8'): Promise<string> {\n const buffer = await this.#worker.readFile(path);\n\n return decodeBuffer(buffer, encoding);\n }\n\n /**\n * Write text to a file with specified encoding\n */\n async writeText(path: string, text: string, encoding: Encoding = 'utf-8'): Promise<void> {\n const buffer = encodeString(text, encoding);\n\n return this.#worker.writeFile(path, buffer);\n }\n\n /**\n * Append text to a file with specified encoding\n */\n async appendText(path: string, text: string, encoding: Encoding = 'utf-8'): Promise<void> {\n const buffer = encodeString(text, encoding);\n\n return this.#worker.appendFile(path, buffer);\n }\n}\n","import { OPFSFileSystem } from './facade';\n\nimport type { OPFSOptions } from './types';\n\nexport * from './types';\nexport * from './utils/errors';\nexport * from './utils/helpers';\nexport * from './utils/encoder';\nexport * from './facade';\n\n/**\n * Creates a new file system instance with inline worker\n * @param options - Optional configuration options\n * @returns Promise resolving to the file system interface\n */\nexport function createWorker(\n options?: OPFSOptions\n): OPFSFileSystem {\n return new OPFSFileSystem(options);\n}\n"],"names":["OPFSFileSystem","#worker","options","wrapped","wrap","WorkerCtor","path","encoding","buffer","isBinaryFileExtension","decodeBuffer","data","encodeString","oldPath","newPath","source","destination","fd","offset","length","position","bytesRead","transferred","emitEvent","size","entries","text","createWorker"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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N,GAAQ,WAAWK,EAAME,CAAM,CAC/C,CACJ,CC9SO,SAASmB,EACZzB,EACc,CACd,OAAO,IAAIF,EAAeE,CAAO,CACrC"}
package/dist/index.d.ts CHANGED
@@ -1,12 +1,14 @@
1
- import type { OPFSOptions, RemoteOPFSWorker } from './types';
1
+ import { OPFSFileSystem } from './facade';
2
+ import type { OPFSOptions } from './types';
2
3
  export * from './types';
3
4
  export * from './utils/errors';
4
5
  export * from './utils/helpers';
5
6
  export * from './utils/encoder';
7
+ export * from './facade';
6
8
  /**
7
9
  * Creates a new file system instance with inline worker
8
10
  * @param options - Optional configuration options
9
11
  * @returns Promise resolving to the file system interface
10
12
  */
11
- export declare function createWorker(options?: OPFSOptions): Promise<RemoteOPFSWorker>;
13
+ export declare function createWorker(options?: OPFSOptions): OPFSFileSystem;
12
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAc,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEzE,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAEhC;;;;GAIG;AACH,wBAAsB,YAAY,CAC9B,OAAO,CAAC,EAAE,WAAW,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAc3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AAEzB;;;;GAIG;AACH,wBAAgB,YAAY,CACxB,OAAO,CAAC,EAAE,WAAW,GACtB,cAAc,CAEhB"}