source: node_modules/detect-libc/README.md@ 62b2964

finki-main main
Last change on this file since 62b2964 was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago

Initial commit

  • Property mode set to 100644
File size: 3.1 KB
RevLine 
[81bc7da]1# detect-libc
2
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 the
9family (e.g. `glibc`, `musl`) and version (e.g. `1.23`, `1.2.3`).
10
11The version numbers of libc implementations
12are not guaranteed to be semver-compliant.
13
14For previous v1.x releases, please see the
15[v1](https://github.com/lovell/detect-libc/tree/v1) branch.
16
17## Install
18
19```sh
20npm install detect-libc
21```
22
23## API
24
25### GLIBC
26
27```ts
28const GLIBC: string = 'glibc';
29```
30
31A String constant containing the value `glibc`.
32
33### MUSL
34
35```ts
36const MUSL: string = 'musl';
37```
38
39A String constant containing the value `musl`.
40
41### family
42
43```ts
44function family(): Promise<string | null>;
45```
46
47Resolves asychronously with:
48
49* `glibc` or `musl` when the libc family can be determined
50* `null` when the libc family cannot be determined
51* `null` when run on a non-Linux platform
52
53```js
54const { family, GLIBC, MUSL } = require('detect-libc');
55
56switch (await family()) {
57 case GLIBC: ...
58 case MUSL: ...
59 case null: ...
60}
61```
62
63### familySync
64
65```ts
66function familySync(): string | null;
67```
68
69Synchronous version of `family()`.
70
71```js
72const { familySync, GLIBC, MUSL } = require('detect-libc');
73
74switch (familySync()) {
75 case GLIBC: ...
76 case MUSL: ...
77 case null: ...
78}
79```
80
81### version
82
83```ts
84function version(): Promise<string | null>;
85```
86
87Resolves asychronously with:
88
89* The version when it can be determined
90* `null` when the libc family cannot be determined
91* `null` when run on a non-Linux platform
92
93```js
94const { version } = require('detect-libc');
95
96const v = await version();
97if (v) {
98 const [major, minor, patch] = v.split('.');
99}
100```
101
102### versionSync
103
104```ts
105function versionSync(): string | null;
106```
107
108Synchronous version of `version()`.
109
110```js
111const { versionSync } = require('detect-libc');
112
113const v = versionSync();
114if (v) {
115 const [major, minor, patch] = v.split('.');
116}
117```
118
119### isNonGlibcLinux
120
121```ts
122function 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 platform
130
131```js
132const { isNonGlibcLinux } = require('detect-libc');
133
134if (await isNonGlibcLinux()) { ... }
135```
136
137### isNonGlibcLinuxSync
138
139```ts
140function isNonGlibcLinuxSync(): boolean;
141```
142
143Synchronous version of `isNonGlibcLinux()`.
144
145```js
146const { isNonGlibcLinuxSync } = require('detect-libc');
147
148if (isNonGlibcLinuxSync()) { ... }
149```
150
151## Licensing
152
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, software
160distributed 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 and
163limitations under the License.
Note: See TracBrowser for help on using the repository browser.