Skip to main content

file

$file

Platform: Node.js

Validates that a path exists in the filesystem and is a file (not a directory or other type). Performs an asynchronous filesystem check using fs.stat().

  • Non-existent paths: "/does/not/exist.txt" → throws "File does not exist"
  • Directory paths: "/var/log" → throws "Path exists but is not a file"
  • Inaccessible paths: "/root/secret.txt" (permission denied) → throws "Cannot access file: ..."