2020-03-12 10:12:27 -04:00
|
|
|
import { notImplemented } from "../_utils.ts";
|
2020-03-03 08:56:10 -05:00
|
|
|
|
|
|
|
export default class Dirent {
|
2020-04-16 01:40:30 -04:00
|
|
|
constructor(private entry: Deno.DirEntry) {}
|
2020-03-03 08:56:10 -05:00
|
|
|
|
|
|
|
isBlockDevice(): boolean {
|
|
|
|
return this.entry.blocks != null;
|
|
|
|
}
|
|
|
|
|
|
|
|
isCharacterDevice(): boolean {
|
|
|
|
return this.entry.blocks == null;
|
|
|
|
}
|
|
|
|
|
|
|
|
isDirectory(): boolean {
|
2020-04-16 01:40:30 -04:00
|
|
|
return this.entry.isDirectory;
|
2020-03-03 08:56:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
isFIFO(): boolean {
|
|
|
|
notImplemented(
|
|
|
|
"Deno does not yet support identification of FIFO named pipes"
|
|
|
|
);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
isFile(): boolean {
|
2020-04-16 01:40:30 -04:00
|
|
|
return this.entry.isFile;
|
2020-03-03 08:56:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
isSocket(): boolean {
|
|
|
|
notImplemented("Deno does not yet support identification of sockets");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
isSymbolicLink(): boolean {
|
2020-04-16 01:40:30 -04:00
|
|
|
return this.entry.isSymlink;
|
2020-03-03 08:56:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
get name(): string | null {
|
|
|
|
return this.entry.name;
|
|
|
|
}
|
|
|
|
}
|