CoolFace
Apppublic

AK-21/Graphite-Industrial-Intelligence

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
README.md164 linesDownload Raw Back to detect-libc
1# detect-libc2 3Node.js module to detect details of the C standard library (libc)4implementation provided by a given Linux system.5 6Currently supports detection of GNU glibc and MUSL libc.7 8Provides asychronous and synchronous functions for the9family (e.g. `glibc`, `musl`) and version (e.g. `1.23`, `1.2.3`).10 11The version numbers of libc implementations12are not guaranteed to be semver-compliant.13 14For previous v1.x releases, please see the15[v1](https://github.com/lovell/detect-libc/tree/v1) branch.16 17## Install18 19```sh20npm install detect-libc21```22 23## API24 25### GLIBC26 27```ts28const GLIBC: string = 'glibc';29```30 31A String constant containing the value `glibc`.32 33### MUSL34 35```ts36const MUSL: string = 'musl';37```38 39A String constant containing the value `musl`.40 41### family42 43```ts44function family(): Promise<string | null>;45```46 47Resolves asychronously with:48 49* `glibc` or `musl` when the libc family can be determined50* `null` when the libc family cannot be determined51* `null` when run on a non-Linux platform52 53```js54const { family, GLIBC, MUSL } = require('detect-libc');55 56switch (await family()) {57  case GLIBC: ...58  case MUSL: ...59  case null: ...60}61```62 63### familySync64 65```ts66function familySync(): string | null;67```68 69Synchronous version of `family()`.70 71```js72const { familySync, GLIBC, MUSL } = require('detect-libc');73 74switch (familySync()) {75  case GLIBC: ...76  case MUSL: ...77  case null: ...78}79```80 81### version82 83```ts84function version(): Promise<string | null>;85```86 87Resolves asychronously with:88 89* The version when it can be determined90* `null` when the libc family cannot be determined91* `null` when run on a non-Linux platform92 93```js94const { version } = require('detect-libc');95 96const v = await version();97if (v) {98  const [major, minor, patch] = v.split('.');99}100```101 102### versionSync103 104```ts105function versionSync(): string | null;106```107 108Synchronous version of `version()`.109 110```js111const { versionSync } = require('detect-libc');112 113const v = versionSync();114if (v) {115  const [major, minor, patch] = v.split('.');116}117```118 119### isNonGlibcLinux120 121```ts122function isNonGlibcLinux(): Promise<boolean>;123```124 125Resolves asychronously with:126 127* `false` when the libc family is `glibc`128* `true` when the libc family is not `glibc`129* `false` when run on a non-Linux platform130 131```js132const { isNonGlibcLinux } = require('detect-libc');133 134if (await isNonGlibcLinux()) { ... }135```136 137### isNonGlibcLinuxSync138 139```ts140function isNonGlibcLinuxSync(): boolean;141```142 143Synchronous version of `isNonGlibcLinux()`.144 145```js146const { isNonGlibcLinuxSync } = require('detect-libc');147 148if (isNonGlibcLinuxSync()) { ... }149```150 151## Licensing152 153Copyright 2017 Lovell Fuller and others.154 155Licensed under the Apache License, Version 2.0 (the "License");156you may not use this file except in compliance with the License.157You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0.html)158 159Unless required by applicable law or agreed to in writing, software160distributed under the License is distributed on an "AS IS" BASIS,161WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.162See the License for the specific language governing permissions and163limitations under the License.164