Skip to content

Commit 82cb0f1

Browse files
committed
get-write-flag: don't test invariants
If we're not on windows, or don't have fmap support, then just make this be a function that always returns 'w'. If it is windows, and has fmap support, only test the size.
1 parent 14dc6f4 commit 82cb0f1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/get-write-flag.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ const { O_CREAT, O_TRUNC, O_WRONLY, UV_FS_O_FILEMAP = 0 } = fs.constants
1313
const fMapEnabled = isWindows && !!UV_FS_O_FILEMAP
1414
const fMapLimit = 512 * 1024
1515
const fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY
16-
module.exports = size => (fMapEnabled && size < fMapLimit) ? fMapFlag : 'w'
16+
module.exports = !fMapEnabled ? () => 'w'
17+
: size => size < fMapLimit ? fMapFlag : 'w'

0 commit comments

Comments
 (0)