-
-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Looking at benchmarks, it seems to be faster to use this impl on Windows than Node's built-in version, and there's fallback to move-remove, which makes it more resilient as well.
- Loading branch information
Showing
3 changed files
with
35 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
const version = process.env.__TESTING_RIMRAF_NODE_VERSION__ || process.version | ||
const versArr = version.replace(/^v/, '').split('.') | ||
const hasNative = +versArr[0] > 14 || (+versArr[0] === 14 && +versArr[1] >= 14) | ||
export const useNative = !hasNative ? () => false : () => true | ||
export const useNativeSync = !hasNative ? () => false : () => true | ||
// we do NOT use native by default on Windows, because Node's native | ||
// rm implementation is less advanced. Change this code if that changes. | ||
import platform from './platform' | ||
export const useNative = | ||
!hasNative || platform === 'win32' ? () => false : () => true | ||
export const useNativeSync = | ||
!hasNative || platform === 'win32' ? () => false : () => true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters