How to use the detect-libc.version function in detect-libc

To help you get started, we’ve selected a few detect-libc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lovell / sharp / install / libvips.js View on Github external
npmLog.info('sharp', `Using existing vendored libvips v${minimumLibvipsVersion}`);
  } else {
    // Is this arch/platform supported?
    const arch = process.env.npm_config_arch || process.arch;
    const platformAndArch = platform();
    if (platformAndArch === 'win32-ia32') {
      throw new Error('Windows x86 (32-bit) node.exe is not supported');
    }
    if (arch === 'ia32') {
      throw new Error(`Intel Architecture 32-bit systems require manual installation of libvips >= ${minimumLibvipsVersion}`);
    }
    if (platformAndArch === 'freebsd-x64' || platformAndArch === 'openbsd-x64' || platformAndArch === 'sunos-x64') {
      throw new Error(`BSD/SunOS systems require manual installation of libvips >= ${minimumLibvipsVersion}`);
    }
    if (detectLibc.family === detectLibc.GLIBC && detectLibc.version && semver.lt(`${detectLibc.version}.0`, '2.17.0')) {
      throw new Error(`Use with glibc version ${detectLibc.version} requires manual installation of libvips >= ${minimumLibvipsVersion}`);
    }
    // Download to per-process temporary file
    const tarFilename = ['libvips', minimumLibvipsVersion, platformAndArch].join('-') + '.tar.gz';
    const tarPathCache = path.join(libvips.cachePath(), tarFilename);
    if (fs.existsSync(tarPathCache)) {
      npmLog.info('sharp', `Using cached ${tarPathCache}`);
      extractTarball(tarPathCache);
    } else {
      const tarPathTemp = path.join(os.tmpdir(), `${process.pid}-${tarFilename}`);
      const tmpFile = fs.createWriteStream(tarPathTemp);
      const url = distBaseUrl + tarFilename;
      npmLog.info('sharp', `Downloading ${url}`);
      simpleGet({ url: url, agent: agent() }, function (err, response) {
        if (err) {
          fail(err);
        } else if (response.statusCode === 404) {

detect-libc

Node.js module to detect the C standard library (libc) implementation family and version

Apache-2.0
Latest version published 8 months ago

Package Health Score

71 / 100
Full package analysis