summaryrefslogtreecommitdiff
path: root/std/node/_fs_dirent.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/node/_fs_dirent.ts')
-rw-r--r--std/node/_fs_dirent.ts41
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;
+ }
+}