-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
Closed
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.
Description
- Version: 6.6.0
- Platform: Darwin fulmen.local 16.1.0 Darwin Kernel Version 16.1.0: Mon Sep 12 19:36:59 PDT 2016; root:xnu-3789.20.43~78/RELEASE_X86_64 x86_64
- Subsystem: "fs" module
Just noticed an inconsistency between Windows and everything else (why, Windows, why?!) for the fs.rmdir()
and fs.rmdirSync()
built-in functions.
const fs = require('fs')
const path = require('path')
fs.rmdirSync(__filename)
Assuming you save this to a file and node
it, this file deletes itself on Windows instead of throwing an error as on Linux and macOS.
Note that fs.unlink()
and fs.unlinkSync()
consistently result in Errors if used on a directory's path.
Update: the snippet results in an "ENOENT" error on Windows, instead of an "ENOTDIR" error as on Linux / macOS
Metadata
Metadata
Assignees
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.