To use the lchownSync
function from the fs-extra
library in TypeScript, you can simply import the lchownSync
function from the library and call it with the required arguments.
index.ts184 chars9 lines
The lchownSync
function changes the owner of a file, symbolic link, or directory, similar to the chown
function, but with the added ability to change the ownership of a symbolic link itself. The function has three required arguments:
path
: A string that represents the path to the file, symbolic link, or directory that you want to change the ownership of.uid
: A number that represents the new owner's uid (user ID).gid
: A number that represents the new owner's gid (group ID).Note: The lchownSync
function is a synchronous function, which means that it will block the execution of the code until the ownership has been changed. It is recommended to use the asynchronous lchown
function if you do not want to block the execution of your code.
gistlibby LogSnag