PHP 8.2.30
Preview: should-print-patch.js Size: 547 B
/opt/alt/alt-nodejs24/root/usr/lib/node_modules/npm/node_modules.bundled/libnpmdiff/lib/should-print-patch.js

const { basename, extname } = require('node:path')

// we should try to print patches as long as the
// extension is not identified as binary files
const shouldPrintPatch = async (path, opts = {}) => {
  if (opts.diffText) {
    return true
  }

  const { default: binaryExtensions } = await import('binary-extensions')

  const filename = basename(path)
  const extension = (
    filename.startsWith('.')
      ? filename
      : extname(filename)
  ).slice(1)

  return !binaryExtensions.includes(extension)
}

module.exports = shouldPrintPatch

Directory Contents

Dirs: 0 × Files: 5

Name Size Perms Modified Actions
3.24 KB lrw-r--r-- 2026-02-23 07:38:44
Edit Download
1.23 KB lrw-r--r-- 2026-02-23 07:38:44
Edit Download
547 B lrw-r--r-- 2026-02-23 07:38:44
Edit Download
1.14 KB lrw-r--r-- 2026-02-23 07:38:44
Edit Download
2.41 KB lrw-r--r-- 2026-02-23 07:38:44
Edit Download

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