unlink
Remove a file. Fails for directories; use rm with recursive: true for directories.
Basic usage
import { unlink } from '@rush-fs/core'
await unlink('./temp.txt')Methods
unlink(path)
Async. Returns Promise<void>.
| Argument | Type | Description |
|---|---|---|
path | string | File path to remove. |
unlinkSync(path)
Sync. Same arguments; throws on error (e.g. ENOENT, EISDIR).
Performance
Single syscall; on par with Node.js. No dedicated benchmark; see Benchmarks for single-file overhead.
Notes
- Directories: Use
rm(path, { recursive: true })orrmdir(path)for empty dirs.unlinkon a directory fails withEISDIR(or equivalent).
Last updated on