Skip to main content

Function: prepareFixedNameWrite()

prepareFixedNameWrite(root, dest, what?): Promise<void>

Makes dest ready to be written as a regular file inside root: its directory is checked like assertWritableWithin (and created when it is missing), and whatever is at dest that is neither a regular file nor a directory, such as a symlink planted by an earlier copy, is removed so that the write creates a new file instead of following it. A directory is left alone: the write fails on it.

Use it before every write to a fixed file name (app-update.yml, elevate.exe, ...) into a directory that untrusted files were copied into.

Parameters​

root​

string

dest​

string

what?​

string = "file"

Returns​

Promise<void>