@@ -16,6 +16,7 @@ export default class NodeFileSystemDirectoryHandle extends NodeFileSystemHandle
|
||||
declare kind: "directory";
|
||||
constructor(path: string, options: FileSystemGetDirectoryOptions & { origin?: NodeFileSystemDirectoryHandle } = {}) {
|
||||
super(path, options)
|
||||
this.kind="directory"
|
||||
try {
|
||||
const stats = fs.statSync(this.path)
|
||||
if (!stats.isDirectory()) throw new Error("tried to open file as directory: " + this.path)
|
||||
|
||||
@@ -17,6 +17,7 @@ export default class NodeFileSystemFileHandle extends NodeFileSystemHandle imple
|
||||
declare kind: "file";
|
||||
constructor(path: string, options: FileSystemGetFileOptions & { origin?: NodeFileSystemDirectoryHandle } = {}) {
|
||||
super(path,options)
|
||||
this.kind="file"
|
||||
let flags = fs.constants.O_RDWR
|
||||
if (options.create) flags |= fs.constants.O_CREAT
|
||||
fs.closeSync(fs.openSync(this.path, flags))
|
||||
|
||||
Reference in New Issue
Block a user