To use the chownsync function from the fs-extra
library in TypeScript, you can simply import the function from fs-extra
like this:
index.ts38 chars2 lines
You can then use the chownSync
function in your code like this:
index.ts140 chars7 lines
The chownSync
function takes 3 arguments:
Note that chownSync
will throw an error if it is unable to change the ownership of the file or directory. You can catch this error and handle it appropriately in your code.
gistlibby LogSnag