diff --git a/src/FileSystemHandle.js b/src/FileSystemHandle.js index 2bab58b..6d7976e 100644 --- a/src/FileSystemHandle.js +++ b/src/FileSystemHandle.js @@ -18,6 +18,7 @@ class FileSystemHandle { async queryPermission ({mode = 'read'} = {}) { const handle = this[kAdapter] + if (handle.queryPermission) { return handle.queryPermission({mode}) } diff --git a/src/adapters/deno.js b/src/adapters/deno.js index 01e3294..12296e9 100644 --- a/src/adapters/deno.js +++ b/src/adapters/deno.js @@ -116,11 +116,13 @@ export class FileHandle { return this.#path } - async createWritable () { - const fileHandle = await Deno.open(this.#path, {write: true}).catch(err => { + /** @param {{ keepExistingData: any; }} opts */ + async createWritable (opts) { + const fileHandle = await Deno.open(this.#path, { write: true, truncate: !opts.keepExistingData }).catch(err => { if (err.name === 'NotFound') throw new DOMException(...GONE) throw err }) + const { size } = await fileHandle.stat() return new Sink(fileHandle, size) }