Skip to main content

Module Native

Module Native 

Source
Expand description

Native FS atoms - URI-aware, direct tokio::fs. Wind/Sky’s file:* channels route here.

Modules§

FileCloneNative
Wire method file:copy / file:cloneFile. tokio::fs::copy preserves content but not xattrs/acls; callers that need metadata should use an OS-specific clone atom (future work).
FileDeleteNative
Wire method file:delete. Honours { recursive } option for directories; useTrash is accepted but not yet implemented (future atom: trash.rs on macOS/Linux via trash-rs, Windows via SHFileOp).
FileExistsNative
Wire method file:exists. Boolean probe via tokio::fs::try_exists.
FileMkdirNative
Wire method file:mkdir. create_dir_all is recursive; matches the Electron default VS Code expects.
FileReadNative
Wire method file:read / file:readFile.
FileReaddirNative
Wire method file:readdir. Returns [[name, fileType]] matching VS Code’s ReadDirResult (FileType: File=1, Directory=2, SymbolicLink=64 - combined via bitflags upstream, but the readdir callers only care about the per-entry value).
FileRealpath
Wire method file:realpath. Emits a VS Code UriComponents ($mid: 1) so the renderer reviver promotes it to a real URI with .fsPath / .with. Plain string would be treated as a relative path.
FileRenameNative
Wire method file:move / file:rename.
FileStatNative
Wire method file:stat. Returns VS Code’s IStat shape via metadata_to_istat. Uses symlink_metadata to avoid following symlinks (matches Electron behaviour). Noise from benign ENOENTs on known VS Code probe paths is squelched via IsBenignEnoent + DebugOnce.
FileWriteNative
Wire method file:write / file:writeFile. Accepts either a plain string body or a { buffer: number[] | base64 } VSBuffer. Parent directory is created best-effort.