https://github.com/notwoods/crossrm
`rm -rf` in a cross-platform implementation. Significantly smaller than rimraf!
https://github.com/notwoods/crossrm
rimraf rm
Last synced: 4 months ago
JSON representation
`rm -rf` in a cross-platform implementation. Significantly smaller than rimraf!
- Host: GitHub
- URL: https://github.com/notwoods/crossrm
- Owner: NotWoods
- License: mit
- Created: 2024-08-18T05:42:07.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-18T18:06:48.000Z (almost 2 years ago)
- Last Synced: 2025-09-29T21:51:54.122Z (9 months ago)
- Topics: rimraf, rm
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/crossrm
- Size: 1.95 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# crossrm
The [UNIX command](http://en.wikipedia.org/wiki/Rm_(Unix)) `rm -rf` for Node.js in a cross-platform implementation. Significantly smaller than `rimraf`!
## Usage
```sh
npx crossrm ./path
```
### Why no JavaScript API?
Node.js v14.14 and up supports [the built-in `fs.rm` function](https://nodejs.org/api/fs.html#fspromisesrmpath-options), which does everything you need. This package is just a thin CLI wrapper around the function.
```ts
import { rm } from 'node:fs/promises';
import { rmSync } from 'node:fs';
// This will throw an error if the path does not exist.
await rm(path, { recursive: true });
rmSync(path, { recursive: true });
// This will do nothing if the path does not exist.
await rm(path, { recursive: true, force: true });
rmSync(path, { recursive: true, force: true });
```