Files
node-file-system-adapter/src/NodeFileSystemHandle.ts
T
sugoidogo 579c4bf131
Release / release (push) Successful in 23s
switch to importable-types-web
2026-02-09 07:09:30 -08:00

19 lines
723 B
TypeScript

import * as path from 'node:path'
import type {
FileSystemHandle,
FileSystemHandleKind
} from '@sugoidogo/importable-types-web'
export default class NodeFileSystemHandle implements FileSystemHandle {
kind: FileSystemHandleKind;
path: string;
get name() { return path.basename(this.path) }
async isSameEntry(other: FileSystemHandle): Promise<boolean> {
if (typeof other != typeof this) return false
let thisName = this.name
let otherName = other.name
if (!path.isAbsolute(this.name)) thisName = path.join(process.cwd(), this.name)
if (!path.isAbsolute(other.name)) otherName = path.join(process.cwd(), other.name)
return thisName === otherName
}
}