@ricsam/quickjs-fs 0.2.2 → 0.2.3

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,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/handles/directory-handle.ts"],
3
+ "sources": ["../../../src/handles/directory-handle.ts"],
4
4
  "sourcesContent": [
5
5
  "import type { StateMap } from \"@ricsam/quickjs-core\";\nimport { defineClass } from \"@ricsam/quickjs-core\";\nimport type { QuickJSContext, QuickJSHandle } from \"quickjs-emscripten\";\nimport type {\n FileSystemDirectoryHandleState,\n FileSystemFileHandleState,\n HostDirectoryHandle,\n} from \"../types.cjs\";\nimport { registerHostFileHandle } from \"./file-handle.cjs\";\n\n// Registry for pending host handles that will be picked up by constructor\nlet nextHostHandleId = 0;\nexport const pendingHostHandles = new Map<\n number,\n { handle: HostDirectoryHandle; name: string }\n>();\n\nexport function registerHostDirectoryHandle(\n handle: HostDirectoryHandle\n): number {\n const id = nextHostHandleId++;\n pendingHostHandles.set(id, { handle, name: handle.name });\n return id;\n}\n\n/**\n * Create the FileSystemDirectoryHandle class for QuickJS\n */\nexport function createFileSystemDirectoryHandleClass(\n context: QuickJSContext,\n stateMap: StateMap\n): QuickJSHandle {\n return defineClass<FileSystemDirectoryHandleState>(context, stateMap, {\n name: \"FileSystemDirectoryHandle\",\n construct: (args) => {\n // First argument is the host handle ID\n const hostHandleId = args[0] as number;\n const pending = pendingHostHandles.get(hostHandleId);\n if (!pending) {\n throw new Error(`No pending host handle with ID ${hostHandleId}`);\n }\n pendingHostHandles.delete(hostHandleId);\n return {\n kind: \"directory\" as const,\n name: pending.name,\n hostHandle: pending.handle,\n };\n },\n properties: {\n kind: {\n get(this: FileSystemDirectoryHandleState) {\n return \"directory\";\n },\n },\n name: {\n get(this: FileSystemDirectoryHandleState) {\n return this.name;\n },\n },\n },\n methods: {\n async _getFileHandleInternal(\n this: FileSystemDirectoryHandleState,\n name: unknown,\n options?: unknown\n ): Promise<{ __fileHandleId: number }> {\n const opts = options as { create?: boolean } | undefined;\n const hostFile = await this.hostHandle.getFileHandle(String(name), {\n create: opts?.create,\n });\n\n return { __fileHandleId: registerHostFileHandle(hostFile) };\n },\n async _getDirectoryHandleInternal(\n this: FileSystemDirectoryHandleState,\n name: unknown,\n options?: unknown\n ): Promise<{ __directoryHandleId: number }> {\n const opts = options as { create?: boolean } | undefined;\n const hostDir = await this.hostHandle.getDirectoryHandle(String(name), {\n create: opts?.create,\n });\n\n return { __directoryHandleId: registerHostDirectoryHandle(hostDir) };\n },\n async removeEntry(\n this: FileSystemDirectoryHandleState,\n name: unknown,\n options?: unknown\n ): Promise<void> {\n const opts = options as { recursive?: boolean } | undefined;\n await this.hostHandle.removeEntry(String(name), {\n recursive: opts?.recursive,\n });\n },\n async resolve(\n this: FileSystemDirectoryHandleState,\n possibleDescendant: unknown\n ): Promise<string[] | null> {\n if (!possibleDescendant || typeof possibleDescendant !== \"object\") {\n return null;\n }\n\n const descendant = possibleDescendant as\n | FileSystemFileHandleState\n | FileSystemDirectoryHandleState;\n return this.hostHandle.resolve(descendant.hostHandle);\n },\n async entries(\n this: FileSystemDirectoryHandleState\n ): Promise<\n Array<\n [string, FileSystemFileHandleState | FileSystemDirectoryHandleState]\n >\n > {\n const result: Array<\n [string, FileSystemFileHandleState | FileSystemDirectoryHandleState]\n > = [];\n\n for await (const [name, handle] of this.hostHandle.entries()) {\n if (handle.kind === \"file\") {\n result.push([\n name,\n {\n kind: \"file\",\n name: handle.name,\n hostHandle: handle,\n },\n ]);\n } else {\n result.push([\n name,\n {\n kind: \"directory\",\n name: handle.name,\n hostHandle: handle,\n },\n ]);\n }\n }\n\n return result;\n },\n async keys(this: FileSystemDirectoryHandleState): Promise<string[]> {\n const result: string[] = [];\n for await (const name of this.hostHandle.keys()) {\n result.push(name);\n }\n return result;\n },\n async values(\n this: FileSystemDirectoryHandleState\n ): Promise<\n Array<FileSystemFileHandleState | FileSystemDirectoryHandleState>\n > {\n const result: Array<\n FileSystemFileHandleState | FileSystemDirectoryHandleState\n > = [];\n\n for await (const handle of this.hostHandle.values()) {\n if (handle.kind === \"file\") {\n result.push({\n kind: \"file\",\n name: handle.name,\n hostHandle: handle,\n });\n } else {\n result.push({\n kind: \"directory\",\n name: handle.name,\n hostHandle: handle,\n });\n }\n }\n\n return result;\n },\n async isSameEntry(\n this: FileSystemDirectoryHandleState,\n other: unknown\n ): Promise<boolean> {\n if (!other || typeof other !== \"object\") {\n return false;\n }\n const otherHandle = other as FileSystemDirectoryHandleState;\n return this.hostHandle === otherHandle.hostHandle;\n },\n },\n });\n}\n"
6
6
  ],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/handles/file-handle.ts"],
3
+ "sources": ["../../../src/handles/file-handle.ts"],
4
4
  "sourcesContent": [
5
5
  "import type { QuickJSContext, QuickJSHandle } from \"quickjs-emscripten\";\nimport type { StateMap } from \"@ricsam/quickjs-core\";\nimport { defineClass } from \"@ricsam/quickjs-core\";\nimport type { FileSystemFileHandleState, HostFileHandle, HostWritableFileStream } from \"../types.cjs\";\n\n// Registry for pending host handles that will be picked up by constructor\nlet nextFileHandleId = 0;\nexport const pendingFileHandles = new Map<number, { handle: HostFileHandle; name: string }>();\nlet nextWritableStreamId = 0;\nexport const pendingWritableStreams = new Map<number, HostWritableFileStream>();\n\nexport function registerHostFileHandle(handle: HostFileHandle): number {\n const id = nextFileHandleId++;\n pendingFileHandles.set(id, { handle, name: handle.name });\n return id;\n}\n\nexport function registerHostWritableStream(stream: HostWritableFileStream): number {\n const id = nextWritableStreamId++;\n pendingWritableStreams.set(id, stream);\n return id;\n}\n\n/**\n * Create the FileSystemFileHandle class for QuickJS\n */\nexport function createFileSystemFileHandleClass(\n context: QuickJSContext,\n stateMap: StateMap\n): QuickJSHandle {\n return defineClass<FileSystemFileHandleState>(context, stateMap, {\n name: \"FileSystemFileHandle\",\n construct: (args) => {\n const hostHandleId = args[0] as number;\n const pending = pendingFileHandles.get(hostHandleId);\n if (!pending) {\n throw new Error(`No pending file handle with ID ${hostHandleId}`);\n }\n pendingFileHandles.delete(hostHandleId);\n return {\n kind: \"file\" as const,\n name: pending.name,\n hostHandle: pending.handle,\n };\n },\n properties: {\n kind: {\n get(this: FileSystemFileHandleState) {\n return \"file\";\n },\n },\n name: {\n get(this: FileSystemFileHandleState) {\n return this.name;\n },\n },\n },\n methods: {\n async getFile(this: FileSystemFileHandleState): Promise<object> {\n const file = await this.hostHandle.getFile();\n\n // Convert native File to our internal File representation\n const buffer = await file.arrayBuffer();\n const data = new Uint8Array(buffer);\n\n return {\n parts: [data],\n type: file.type,\n size: file.size,\n name: file.name,\n lastModified: file.lastModified,\n webkitRelativePath: \"\",\n // Include methods that will be recognized\n async text() {\n return new TextDecoder().decode(data);\n },\n async arrayBuffer() {\n return buffer;\n },\n async bytes() {\n return data;\n },\n };\n },\n async _createWritableInternal(\n this: FileSystemFileHandleState,\n options?: unknown\n ): Promise<{ __writableStreamId: number }> {\n const opts = options as { keepExistingData?: boolean } | undefined;\n const hostStream = await this.hostHandle.createWritable({\n keepExistingData: opts?.keepExistingData,\n });\n\n return { __writableStreamId: registerHostWritableStream(hostStream) };\n },\n async isSameEntry(\n this: FileSystemFileHandleState,\n other: unknown\n ): Promise<boolean> {\n if (!other || typeof other !== \"object\") {\n return false;\n }\n const otherHandle = other as FileSystemFileHandleState;\n return this.hostHandle === otherHandle.hostHandle;\n },\n },\n });\n}\n"
6
6
  ],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/handles/writable-stream.ts"],
3
+ "sources": ["../../../src/handles/writable-stream.ts"],
4
4
  "sourcesContent": [
5
5
  "import type { QuickJSContext, QuickJSHandle } from \"quickjs-emscripten\";\nimport type { StateMap } from \"@ricsam/quickjs-core\";\nimport { defineClass } from \"@ricsam/quickjs-core\";\nimport type {\n FileSystemWritableFileStreamState,\n WriteParams,\n HostWritableFileStream,\n} from \"../types.cjs\";\nimport { pendingWritableStreams } from \"./file-handle.cjs\";\n\n/**\n * Create the FileSystemWritableFileStream class for QuickJS\n */\nexport function createFileSystemWritableFileStreamClass(\n context: QuickJSContext,\n stateMap: StateMap\n): QuickJSHandle {\n return defineClass<FileSystemWritableFileStreamState>(context, stateMap, {\n name: \"FileSystemWritableFileStream\",\n construct: (args) => {\n const streamId = args[0] as number;\n const hostStream = pendingWritableStreams.get(streamId);\n if (!hostStream) {\n throw new Error(`No pending writable stream with ID ${streamId}`);\n }\n pendingWritableStreams.delete(streamId);\n return {\n hostStream,\n closed: false,\n };\n },\n methods: {\n async write(\n this: FileSystemWritableFileStreamState,\n data: unknown\n ): Promise<void> {\n if (this.closed) {\n throw new Error(\"Stream is closed\");\n }\n\n // Handle WriteParams\n if (data && typeof data === \"object\" && \"type\" in data) {\n const params = data as WriteParams;\n if (params.type === \"seek\" && params.position !== undefined) {\n await this.hostStream.seek(params.position);\n return;\n }\n if (params.type === \"truncate\" && params.size !== undefined) {\n await this.hostStream.truncate(params.size);\n return;\n }\n if (params.type === \"write\" && params.data !== undefined) {\n await this.hostStream.write(params.data);\n return;\n }\n }\n\n // Direct data write\n if (typeof data === \"string\") {\n await this.hostStream.write(data);\n } else if (data instanceof ArrayBuffer) {\n await this.hostStream.write(data);\n } else if (data instanceof Uint8Array) {\n await this.hostStream.write(data);\n } else if (data && typeof data === \"object\" && \"parts\" in data) {\n // Blob-like\n const parts = (data as { parts: Uint8Array[] }).parts;\n for (const part of parts) {\n await this.hostStream.write(part);\n }\n } else {\n await this.hostStream.write(String(data));\n }\n },\n async seek(\n this: FileSystemWritableFileStreamState,\n position: unknown\n ): Promise<void> {\n if (this.closed) {\n throw new Error(\"Stream is closed\");\n }\n await this.hostStream.seek(Number(position));\n },\n async truncate(\n this: FileSystemWritableFileStreamState,\n size: unknown\n ): Promise<void> {\n if (this.closed) {\n throw new Error(\"Stream is closed\");\n }\n await this.hostStream.truncate(Number(size));\n },\n async close(this: FileSystemWritableFileStreamState): Promise<void> {\n if (this.closed) {\n return;\n }\n this.closed = true;\n await this.hostStream.close();\n },\n async abort(\n this: FileSystemWritableFileStreamState,\n reason?: unknown\n ): Promise<void> {\n if (this.closed) {\n return;\n }\n this.closed = true;\n await this.hostStream.abort(reason);\n },\n },\n });\n}\n"
6
6
  ],
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/quickjs-fs",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "type": "commonjs"
5
5
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/handles/directory-handle.ts"],
3
+ "sources": ["../../../src/handles/directory-handle.ts"],
4
4
  "sourcesContent": [
5
5
  "import type { StateMap } from \"@ricsam/quickjs-core\";\nimport { defineClass } from \"@ricsam/quickjs-core\";\nimport type { QuickJSContext, QuickJSHandle } from \"quickjs-emscripten\";\nimport type {\n FileSystemDirectoryHandleState,\n FileSystemFileHandleState,\n HostDirectoryHandle,\n} from \"../types.mjs\";\nimport { registerHostFileHandle } from \"./file-handle.mjs\";\n\n// Registry for pending host handles that will be picked up by constructor\nlet nextHostHandleId = 0;\nexport const pendingHostHandles = new Map<\n number,\n { handle: HostDirectoryHandle; name: string }\n>();\n\nexport function registerHostDirectoryHandle(\n handle: HostDirectoryHandle\n): number {\n const id = nextHostHandleId++;\n pendingHostHandles.set(id, { handle, name: handle.name });\n return id;\n}\n\n/**\n * Create the FileSystemDirectoryHandle class for QuickJS\n */\nexport function createFileSystemDirectoryHandleClass(\n context: QuickJSContext,\n stateMap: StateMap\n): QuickJSHandle {\n return defineClass<FileSystemDirectoryHandleState>(context, stateMap, {\n name: \"FileSystemDirectoryHandle\",\n construct: (args) => {\n // First argument is the host handle ID\n const hostHandleId = args[0] as number;\n const pending = pendingHostHandles.get(hostHandleId);\n if (!pending) {\n throw new Error(`No pending host handle with ID ${hostHandleId}`);\n }\n pendingHostHandles.delete(hostHandleId);\n return {\n kind: \"directory\" as const,\n name: pending.name,\n hostHandle: pending.handle,\n };\n },\n properties: {\n kind: {\n get(this: FileSystemDirectoryHandleState) {\n return \"directory\";\n },\n },\n name: {\n get(this: FileSystemDirectoryHandleState) {\n return this.name;\n },\n },\n },\n methods: {\n async _getFileHandleInternal(\n this: FileSystemDirectoryHandleState,\n name: unknown,\n options?: unknown\n ): Promise<{ __fileHandleId: number }> {\n const opts = options as { create?: boolean } | undefined;\n const hostFile = await this.hostHandle.getFileHandle(String(name), {\n create: opts?.create,\n });\n\n return { __fileHandleId: registerHostFileHandle(hostFile) };\n },\n async _getDirectoryHandleInternal(\n this: FileSystemDirectoryHandleState,\n name: unknown,\n options?: unknown\n ): Promise<{ __directoryHandleId: number }> {\n const opts = options as { create?: boolean } | undefined;\n const hostDir = await this.hostHandle.getDirectoryHandle(String(name), {\n create: opts?.create,\n });\n\n return { __directoryHandleId: registerHostDirectoryHandle(hostDir) };\n },\n async removeEntry(\n this: FileSystemDirectoryHandleState,\n name: unknown,\n options?: unknown\n ): Promise<void> {\n const opts = options as { recursive?: boolean } | undefined;\n await this.hostHandle.removeEntry(String(name), {\n recursive: opts?.recursive,\n });\n },\n async resolve(\n this: FileSystemDirectoryHandleState,\n possibleDescendant: unknown\n ): Promise<string[] | null> {\n if (!possibleDescendant || typeof possibleDescendant !== \"object\") {\n return null;\n }\n\n const descendant = possibleDescendant as\n | FileSystemFileHandleState\n | FileSystemDirectoryHandleState;\n return this.hostHandle.resolve(descendant.hostHandle);\n },\n async entries(\n this: FileSystemDirectoryHandleState\n ): Promise<\n Array<\n [string, FileSystemFileHandleState | FileSystemDirectoryHandleState]\n >\n > {\n const result: Array<\n [string, FileSystemFileHandleState | FileSystemDirectoryHandleState]\n > = [];\n\n for await (const [name, handle] of this.hostHandle.entries()) {\n if (handle.kind === \"file\") {\n result.push([\n name,\n {\n kind: \"file\",\n name: handle.name,\n hostHandle: handle,\n },\n ]);\n } else {\n result.push([\n name,\n {\n kind: \"directory\",\n name: handle.name,\n hostHandle: handle,\n },\n ]);\n }\n }\n\n return result;\n },\n async keys(this: FileSystemDirectoryHandleState): Promise<string[]> {\n const result: string[] = [];\n for await (const name of this.hostHandle.keys()) {\n result.push(name);\n }\n return result;\n },\n async values(\n this: FileSystemDirectoryHandleState\n ): Promise<\n Array<FileSystemFileHandleState | FileSystemDirectoryHandleState>\n > {\n const result: Array<\n FileSystemFileHandleState | FileSystemDirectoryHandleState\n > = [];\n\n for await (const handle of this.hostHandle.values()) {\n if (handle.kind === \"file\") {\n result.push({\n kind: \"file\",\n name: handle.name,\n hostHandle: handle,\n });\n } else {\n result.push({\n kind: \"directory\",\n name: handle.name,\n hostHandle: handle,\n });\n }\n }\n\n return result;\n },\n async isSameEntry(\n this: FileSystemDirectoryHandleState,\n other: unknown\n ): Promise<boolean> {\n if (!other || typeof other !== \"object\") {\n return false;\n }\n const otherHandle = other as FileSystemDirectoryHandleState;\n return this.hostHandle === otherHandle.hostHandle;\n },\n },\n });\n}\n"
6
6
  ],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/handles/file-handle.ts"],
3
+ "sources": ["../../../src/handles/file-handle.ts"],
4
4
  "sourcesContent": [
5
5
  "import type { QuickJSContext, QuickJSHandle } from \"quickjs-emscripten\";\nimport type { StateMap } from \"@ricsam/quickjs-core\";\nimport { defineClass } from \"@ricsam/quickjs-core\";\nimport type { FileSystemFileHandleState, HostFileHandle, HostWritableFileStream } from \"../types.mjs\";\n\n// Registry for pending host handles that will be picked up by constructor\nlet nextFileHandleId = 0;\nexport const pendingFileHandles = new Map<number, { handle: HostFileHandle; name: string }>();\nlet nextWritableStreamId = 0;\nexport const pendingWritableStreams = new Map<number, HostWritableFileStream>();\n\nexport function registerHostFileHandle(handle: HostFileHandle): number {\n const id = nextFileHandleId++;\n pendingFileHandles.set(id, { handle, name: handle.name });\n return id;\n}\n\nexport function registerHostWritableStream(stream: HostWritableFileStream): number {\n const id = nextWritableStreamId++;\n pendingWritableStreams.set(id, stream);\n return id;\n}\n\n/**\n * Create the FileSystemFileHandle class for QuickJS\n */\nexport function createFileSystemFileHandleClass(\n context: QuickJSContext,\n stateMap: StateMap\n): QuickJSHandle {\n return defineClass<FileSystemFileHandleState>(context, stateMap, {\n name: \"FileSystemFileHandle\",\n construct: (args) => {\n const hostHandleId = args[0] as number;\n const pending = pendingFileHandles.get(hostHandleId);\n if (!pending) {\n throw new Error(`No pending file handle with ID ${hostHandleId}`);\n }\n pendingFileHandles.delete(hostHandleId);\n return {\n kind: \"file\" as const,\n name: pending.name,\n hostHandle: pending.handle,\n };\n },\n properties: {\n kind: {\n get(this: FileSystemFileHandleState) {\n return \"file\";\n },\n },\n name: {\n get(this: FileSystemFileHandleState) {\n return this.name;\n },\n },\n },\n methods: {\n async getFile(this: FileSystemFileHandleState): Promise<object> {\n const file = await this.hostHandle.getFile();\n\n // Convert native File to our internal File representation\n const buffer = await file.arrayBuffer();\n const data = new Uint8Array(buffer);\n\n return {\n parts: [data],\n type: file.type,\n size: file.size,\n name: file.name,\n lastModified: file.lastModified,\n webkitRelativePath: \"\",\n // Include methods that will be recognized\n async text() {\n return new TextDecoder().decode(data);\n },\n async arrayBuffer() {\n return buffer;\n },\n async bytes() {\n return data;\n },\n };\n },\n async _createWritableInternal(\n this: FileSystemFileHandleState,\n options?: unknown\n ): Promise<{ __writableStreamId: number }> {\n const opts = options as { keepExistingData?: boolean } | undefined;\n const hostStream = await this.hostHandle.createWritable({\n keepExistingData: opts?.keepExistingData,\n });\n\n return { __writableStreamId: registerHostWritableStream(hostStream) };\n },\n async isSameEntry(\n this: FileSystemFileHandleState,\n other: unknown\n ): Promise<boolean> {\n if (!other || typeof other !== \"object\") {\n return false;\n }\n const otherHandle = other as FileSystemFileHandleState;\n return this.hostHandle === otherHandle.hostHandle;\n },\n },\n });\n}\n"
6
6
  ],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/handles/writable-stream.ts"],
3
+ "sources": ["../../../src/handles/writable-stream.ts"],
4
4
  "sourcesContent": [
5
5
  "import type { QuickJSContext, QuickJSHandle } from \"quickjs-emscripten\";\nimport type { StateMap } from \"@ricsam/quickjs-core\";\nimport { defineClass } from \"@ricsam/quickjs-core\";\nimport type {\n FileSystemWritableFileStreamState,\n WriteParams,\n HostWritableFileStream,\n} from \"../types.mjs\";\nimport { pendingWritableStreams } from \"./file-handle.mjs\";\n\n/**\n * Create the FileSystemWritableFileStream class for QuickJS\n */\nexport function createFileSystemWritableFileStreamClass(\n context: QuickJSContext,\n stateMap: StateMap\n): QuickJSHandle {\n return defineClass<FileSystemWritableFileStreamState>(context, stateMap, {\n name: \"FileSystemWritableFileStream\",\n construct: (args) => {\n const streamId = args[0] as number;\n const hostStream = pendingWritableStreams.get(streamId);\n if (!hostStream) {\n throw new Error(`No pending writable stream with ID ${streamId}`);\n }\n pendingWritableStreams.delete(streamId);\n return {\n hostStream,\n closed: false,\n };\n },\n methods: {\n async write(\n this: FileSystemWritableFileStreamState,\n data: unknown\n ): Promise<void> {\n if (this.closed) {\n throw new Error(\"Stream is closed\");\n }\n\n // Handle WriteParams\n if (data && typeof data === \"object\" && \"type\" in data) {\n const params = data as WriteParams;\n if (params.type === \"seek\" && params.position !== undefined) {\n await this.hostStream.seek(params.position);\n return;\n }\n if (params.type === \"truncate\" && params.size !== undefined) {\n await this.hostStream.truncate(params.size);\n return;\n }\n if (params.type === \"write\" && params.data !== undefined) {\n await this.hostStream.write(params.data);\n return;\n }\n }\n\n // Direct data write\n if (typeof data === \"string\") {\n await this.hostStream.write(data);\n } else if (data instanceof ArrayBuffer) {\n await this.hostStream.write(data);\n } else if (data instanceof Uint8Array) {\n await this.hostStream.write(data);\n } else if (data && typeof data === \"object\" && \"parts\" in data) {\n // Blob-like\n const parts = (data as { parts: Uint8Array[] }).parts;\n for (const part of parts) {\n await this.hostStream.write(part);\n }\n } else {\n await this.hostStream.write(String(data));\n }\n },\n async seek(\n this: FileSystemWritableFileStreamState,\n position: unknown\n ): Promise<void> {\n if (this.closed) {\n throw new Error(\"Stream is closed\");\n }\n await this.hostStream.seek(Number(position));\n },\n async truncate(\n this: FileSystemWritableFileStreamState,\n size: unknown\n ): Promise<void> {\n if (this.closed) {\n throw new Error(\"Stream is closed\");\n }\n await this.hostStream.truncate(Number(size));\n },\n async close(this: FileSystemWritableFileStreamState): Promise<void> {\n if (this.closed) {\n return;\n }\n this.closed = true;\n await this.hostStream.close();\n },\n async abort(\n this: FileSystemWritableFileStreamState,\n reason?: unknown\n ): Promise<void> {\n if (this.closed) {\n return;\n }\n this.closed = true;\n await this.hostStream.abort(reason);\n },\n },\n });\n}\n"
6
6
  ],
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/quickjs-fs",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "type": "module"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/quickjs-fs",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "main": "./dist/cjs/index.cjs",
5
5
  "types": "./dist/types/index.d.ts",
6
6
  "exports": {
@@ -16,7 +16,7 @@
16
16
  "typecheck": "tsc --noEmit"
17
17
  },
18
18
  "dependencies": {
19
- "@ricsam/quickjs-core": "^0.2.2",
19
+ "@ricsam/quickjs-core": "^0.2.3",
20
20
  "quickjs-emscripten": "^0.31.0"
21
21
  },
22
22
  "peerDependencies": {