Documentation
¶
Overview ¶
Package nodefs ports the fs contracts Pi relies on: the directory order of fs.readdirSync and fs.existsSync.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Access ¶
Access is fs.accessSync(path, F_OK) and reports whether it succeeds. Unlike Exists it is the one existence check Node shares between platforms: on Unix both are access(2).
Ports packages/coding-agent/src/utils/shell.ts (the accessSync(path, F_OK) existence check of shellPathExists).
func EntryKind ¶
EntryKind classifies a directory entry as Pi's directory collectors do: from the entry's own type, following the link with a stat only for a symlink. ok is false for a symlink whose target cannot be read, which those collectors skip. It does not stat a plain file or directory, so an entry whose name Node decoded still counts as the file or directory it was listed as.
func Exists ¶
Exists is fs.existsSync: Node asks access(2) for F_OK, which follows symbolic links and reads no metadata. Unlike os.Stat it allocates only the system call's copy of name: no FileInfo, and no PathError for a missing path.
func ParentDir ¶
ParentDir is filepath.Dir of dir, and whether dir was already clean. clean reports that dir is a clean path, so the parent is dir sliced at its last separator, which costs no allocation; filepath.Dir cleans, and on Windows builds a new string for every path with a volume name. A caller passes the returned parent back with clean true. The first call of a walk passes clean false, as the caller's own path may be unclean.
func ReadDir ¶
ReadDir returns the entries of the directory named by name in the order Node's fs.readdirSync returns them. libuv's scandir sorts them by name (strcmp) on Unix-like systems and returns them in the file system's own order on Windows, which on NTFS ignores case. On an error it returns the entries read before it, as os.ReadDir does. Like Node it hands out each name decoded as UTF-8, U+FFFD for each ill-formed subpart, so a path joined from such a name no longer names the file, as in Pi.
Types ¶
type PathProbe ¶
type PathProbe struct {
// contains filtered or unexported fields
}
PathProbe asks fs.existsSync of paths below a directory without building a path string per probe: an ancestor walk probes the same few names at every level. The zero value is ready to use; one PathProbe serves one goroutine.