remove close/abort override
Release / release (push) Successful in 23s

This commit is contained in:
2026-02-15 20:22:23 -08:00
parent 1bd153de5b
commit bbd975feb6
2 changed files with 12 additions and 22 deletions
+12 -9
View File
@@ -1,14 +1,17 @@
import NodeFileSystemDirectoryHandle from '../dist/NodeFileSystemDirectoryHandle.js'
import NodeFileSystemDirectoryHandle from '../src/NodeFileSystemDirectoryHandle.ts'
const textText="Hello World!"
const cwd_directory_handle = new NodeFileSystemDirectoryHandle('.')
const test_directory_handle=await cwd_directory_handle.getDirectoryHandle('test',{'create':true})
const file_handle = await test_directory_handle.getFileHandle('test.txt', { 'create': true })
const writable = await file_handle.createWritable()
writable.write('Hello World!')
writable.close()
const file = await file_handle.getFile()
console.log(file.type)
console.log(await file.text())
const test_directory_handle = await cwd_directory_handle.getDirectoryHandle('test', { 'create': true })
for (let i = 0; i < 10000; i++) {
const file_handle = await test_directory_handle.getFileHandle(i+'.txt', { 'create': true })
const writable = await file_handle.createWritable()
await writable.write('Hello World!')
await writable.close()
const file = await file_handle.getFile()
const text = await file.text()
if(text!==textText) throw new Error("failed to read back written data")
}
const result = await cwd_directory_handle.getFileHandle('test/test.txt').catch(error => 'blocked path traversal')
if (typeof result === 'string') console.log(result)
else console.error('path traversal not blocked')
-13
View File
@@ -44,17 +44,4 @@ export default class NodeFileSystemWritableFileStream extends WritableStream imp
fs.writeSync(this.#fd, (wdata as Uint8Array), null, wsize, this.#seek_position)
this.#seek_position = pseek_position
}
async #_close() {
try {
fs.closeSync(this.#fd)
} catch { }
}
async close(): Promise<void> {
await super.close()
await this.#_close()
}
async abort(reason?: any): Promise<void> {
await super.abort(reason)
await this.#_close()
}
}