index.ts231 chars11 linesIn the code above, we import the fs-extra library and then call its rm function by passing the file or directory path as a string and an options object as its second argument.
The options object has a recursive flag which, when set to true, enables the function to remove directories with their subdirectories and files. The third argument is a callback function that will be called after the operation is completed. If an error occurs during the removal process, the callback function receives the error object via its first parameter.
Note: Make sure to have the proper permissions to delete the file or directory.
gistlibby LogSnag