Skip to content

Commit af0d6f8

Browse files
committed
fix: do not create file when export
1 parent 0835850 commit af0d6f8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/io/common.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ export async function check(code: Promisable<number>): Promise<void> {
1010
export function ignoredDataView(): DataView {
1111
return new DataView(new ArrayBuffer(4))
1212
}
13-
export async function getHandleFromPath(path: string): Promise<FileSystemFileHandle> {
13+
14+
export async function getHandleFromPath(path: string, create?: boolean): Promise<FileSystemFileHandle> {
1415
const root = await navigator.storage.getDirectory()
15-
const handle = await root.getFileHandle(path, { create: true })
16-
return handle
16+
return await root.getFileHandle(path, { create })
1717
}
1818

1919
export function isOpfsVFS(vfs: FacadeVFS): boolean {

src/io/import.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ async function importDatabaseToOpfs(
124124
path: string,
125125
source: ReadableStream<Uint8Array>,
126126
): Promise<void> {
127-
const handle = await getHandleFromPath(path)
127+
const handle = await getHandleFromPath(path, true)
128128
const [streamForVerify, streamData] = source.tee()
129129

130130
await parseHeaderAndVerify(streamForVerify.getReader())

0 commit comments

Comments
 (0)