To use the rmsync
function from the fs-extra
library in TypeScript, first you need to install the library and its types:
index.ts52 chars3 lines
Then, you can import the rmsync
function and use it like this:
index.ts184 chars9 lines
The rmsync
function removes a folder and its contents recursively. It's similar to the built-in rm -rf
command in Unix-based systems.
Note: if you are using TypeScript with a version less than 4.1, you may get an error when importing the rmsync
function from fs-extra
. In this case, you should import it like this:
index.ts44 chars2 lines
Also, make sure that your tsconfig.json
file has the "esModuleInterop": true
flag set, or you may get an error related to importing the function.
gistlibby LogSnag