diff options
author | Chris Knight <cknight1234@gmail.com> | 2020-03-03 13:56:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-03 08:56:10 -0500 |
commit | 3968308886dec239a071503bf09352f893e1da83 (patch) | |
tree | aaec064149e262ccbcd7d3b2827261a315f5a521 /std/node/_fs_dirent.ts | |
parent | eafd40feabaf14f9f88748c66fa319519fd69072 (diff) |
feat(std/node): add directory classes (#4087)
Diffstat (limited to 'std/node/_fs_dirent.ts')
-rw-r--r-- | std/node/_fs_dirent.ts | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/std/node/_fs_dirent.ts b/std/node/_fs_dirent.ts new file mode 100644 index 000000000..74447f404 --- /dev/null +++ b/std/node/_fs_dirent.ts @@ -0,0 +1,41 @@ +import { notImplemented } from "./_utils.ts"; + +export default class Dirent { + constructor(private entry: Deno.FileInfo) {} + + isBlockDevice(): boolean { + return this.entry.blocks != null; + } + + isCharacterDevice(): boolean { + return this.entry.blocks == null; + } + + isDirectory(): boolean { + return this.entry.isDirectory(); + } + + isFIFO(): boolean { + notImplemented( + "Deno does not yet support identification of FIFO named pipes" + ); + return false; + } + + isFile(): boolean { + return this.entry.isFile(); + } + + isSocket(): boolean { + notImplemented("Deno does not yet support identification of sockets"); + return false; + } + + isSymbolicLink(): boolean { + return this.entry.isSymlink(); + } + + get name(): string | null { + return this.entry.name; + } +} |