How to use the rimraf function from rimraf
Find comprehensive JavaScript rimraf.rimraf code examples handpicked from public code repositorys.
rimraf is a Node.js package that provides a cross-platform command-line interface to delete files and directories.
711 712 713 714 715 716 717 718 719 720 721
function cleanBuildDir() { // Sanity check. if (BUILD_DIR === '.' || BUILD_DIR === '/') { return Promise.reject(`Refusing to rm -rf ${BUILD_DIR}`); } return rimraf(BUILD_DIR); } /** * Runs clang format on all files in the core directory.
0
1
1
+ 11 other calls in file
How does rimraf.rimraf work?
rimraf
is a cross-platform Node.js package that provides a recursive force removal function to delete files and directories, including all their contents and subdirectories, and it handles various edge cases that may prevent standard removal operations.
Ai Example
1 2 3 4 5 6 7 8 9
const rimraf = require("rimraf"); rimraf("/path/to/directory", (err) => { if (err) { console.error(err); } else { console.log("Directory has been deleted!"); } });
This code would delete the directory located at /path/to/directory and log a message to the console once the operation is completed.
rimraf.sync is the most popular function in rimraf (722 examples)