-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
It returns the path type according to its on-disk representation.
Possible results include: file, directory, symlink, socket, fifo, characterDevice, blockDevice
// The path argument may be absolute or relative to the root directory.
fs.typeof('foo')The best use case for this is a switch statement.
switch (fs.typeof(path)) {
case 'file':
// ...
break
case 'directory':
// ...
break
default:
throw new Error('unsupported file type')
}This is better than using fs.stat or fs.lstat, because change events don't need to be watched for like they do with those methods. Just need to use the existenceWatcher, I think.
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed