PHP 8.2.30
Preview: get-write-flag.js Size: 921 B
//opt/alt/alt-nodejs22/root/usr/lib/node_modules/npm/node_modules/tar/lib/get-write-flag.js

// Get the appropriate flag to use for creating files
// We use fmap on Windows platforms for files less than
// 512kb.  This is a fairly low limit, but avoids making
// things slower in some cases.  Since most of what this
// library is used for is extracting tarballs of many
// relatively small files in npm packages and the like,
// it can be a big boost on Windows platforms.
// Only supported in Node v12.9.0 and above.
const platform = process.env.__FAKE_PLATFORM__ || process.platform
const isWindows = platform === 'win32'
const fs = global.__FAKE_TESTING_FS__ || require('fs')

/* istanbul ignore next */
const { O_CREAT, O_TRUNC, O_WRONLY, UV_FS_O_FILEMAP = 0 } = fs.constants

const fMapEnabled = isWindows && !!UV_FS_O_FILEMAP
const fMapLimit = 512 * 1024
const fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY
module.exports = !fMapEnabled ? () => 'w'
  : size => size < fMapLimit ? fMapFlag : 'w'

Directory Contents

Dirs: 0 × Files: 25

Name Size Perms Modified Actions
2.34 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
2.79 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
921 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
8.94 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
760 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
2.18 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
3.15 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
5.36 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
649 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
412 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
410 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
9.79 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
15.94 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
4.31 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
3.97 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
2.78 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
5.64 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
917 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
394 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
1.07 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
25.23 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download
937 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
725 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
535 B lrw-r--r-- 2026-02-23 06:53:59
Edit Download
14.94 KB lrw-r--r-- 2026-02-23 06:53:59
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).