Installations
npm install linux-release-info
Developer Guide
Typescript
Yes
Module System
CommonJS
Min. Node Version
>=8.0
Node Version
12.13.0
NPM Version
6.12.0
Score
75.2
Supply Chain
100
Quality
75.5
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (85.3%)
JavaScript (14.7%)
Developer
samuelcarreira
Download Statistics
Total Downloads
319,685
Last Day
459
Last Week
1,932
Last Month
8,884
Last Year
71,391
GitHub Statistics
5 Stars
16 Commits
3 Forks
1 Watching
11 Branches
1 Contributors
Bundle Size
1.53 kB
Minified
711.00 B
Minified + Gzipped
Package Meta Information
Latest Version
3.0.0
Package Id
linux-release-info@3.0.0
Unpacked Size
16.47 kB
Size
5.39 kB
File Count
7
NPM Version
6.12.0
Node Version
12.13.0
Total Downloads
Cumulative downloads
Total Downloads
319,685
Last day
1.5%
459
Compared to previous day
Last week
-5.9%
1,932
Compared to previous week
Last month
37%
8,884
Compared to previous month
Last year
16.2%
71,391
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
2
Linux Release Info
Get Linux release info (distribution name, version, arch, release, etc.) from '/etc/os-release' or '/usr/lib/os-release' files and from native os module. On Windows and Darwin platforms it only returns common node os module info (platform, hostname, release, and arch)
Key Features
- Secure and lightweight: (without any dependencies, only native Node modules)
- Asynchronous file reading
- Synchronous file reading (NEW feature version >= 2.0.0)
- Specify custom os-release file
- Written in TypeScript
- Well documented and easy to use
Installation
npm install --save linux-release-info
or
yarn add linux-release-info
Usage
Basic usage (async)
const {releaseInfo} = require('linux-release-info');
releaseInfo()
.then(result => {
console.log(`You are using ${result.pretty_name} on a ${result.arch} machine`); // Distro name (only on linux) and arch info
})
.catch(err => console.error(`Error reading OS release info: ${err}`))
Outputs:
> You are using Ubuntu 17.10 on a x64 machine
Synchronous read
const releaseInfo = require('linux-release-info');
try {
const infoSyncData = releaseInfo({mode: 'sync'});
console.log(`You are using ${infoSyncData.pretty_name} on a ${infoSyncData.arch} machine`)
} catch (err) {
console.error(`Error reading OS release info: ${err}`);
}
Custom os_release file
const infoSyncData = releaseInfo({mode: 'sync', custom_file: '/home/user/os_release_sample'), debug: true});
Options
Property | Type | Default | Description |
---|---|---|---|
mode | string | async | 'sync' or 'async' mode |
custom_file | string | null/none | custom complete filepath with os info. If not provided the system will search on the /etc/os-release and /usr/lib/os-release files |
debug | boolean | false | shows console debug messages |
Sample outputs
Linux
{ type: 'Linux',
platform: 'linux',
hostname: 'VirtualBoxLINUX',
arch: 'x64',
release: '4.13.0-32-generic',
name: 'Ubuntu',
version: '17.10 (Artful Aardvark)',
id: 'ubuntu',
id_like: 'debian',
pretty_name: 'Ubuntu 17.10',
version_id: '17.10',
home_url: 'https://www.ubuntu.com/',
support_url: 'https://help.ubuntu.com/',
bug_report_url: 'https://bugs.launchpad.net/ubuntu/',
privacy_policy_url: 'https://www.ubuntu.com/legal/terms-and-policies/privacy-policy',
version_codename: 'artful',
ubuntu_codename: 'artful' }
Linux (Raspberry Pi)
{ type: 'Linux',
platform: 'linux',
hostname: 'raspberrypi',
arch: 'arm',
release: '4.19.118-v7+',
pretty_name: 'Raspbian GNU/Linux 10 (buster)',
name: 'Raspbian GNU/Linux',
version_id: '10',
version: '10 (buster)',
version_codename: 'buster',
id: 'raspbian',
id_like: 'debian',
home_url: 'http://www.raspbian.org/',
support_url: 'http://www.raspbian.org/RaspbianForums',
bug_report_url: 'http://www.raspbian.org/RaspbianBugs' }
Linux (Fedora)
{ type: 'Linux',
platform: 'linux',
hostname: 'localhost-live',
arch: 'x64',
release: '4.13.9-300.fc27.x86_64',
name: 'Fedora',
version: '27 (Workstation Edition)',
id: 'fedora',
version_id: '27',
pretty_name: 'Fedora 27 (Workstation Edition)',
ansi_color: '0;34',
cpe_name: 'cpe:/o:fedoraproject:fedora:27',
home_url: 'https://fedoraproject.org/',
support_url: 'https://fedoraproject.org/wiki/Communicating_and_getting_help',
bug_report_url: 'https://bugzilla.redhat.com/',
redhat_bugzilla_product: 'Fedora',
redhat_bugzilla_product_version: '27',
redhat_support_product: 'Fedora',
redhat_support_product_version: '27',
privacy_policy_url: 'https://fedoraproject.org/wiki/Legal:PrivacyPolicy',
variant: 'Workstation Edition',
variant_id: 'workstation' }
Windows
{ type: 'Windows_NT',
platform: 'win32',
hostname: 'MYPC',
arch: 'x64',
release: '10.0.16299' }
macOS
{ type: 'Darwin',
platform: 'darwin',
hostname: 'Macbook-Air.home',
arch: 'x64',
release: '16.0.0' }
Requirements
You need Node.js v.8.x or greater to use the version 2.x of this module
About the sync mode
It's not recommended to use blocking functions to access the filesystem. Use the synchronous mode only if you need to.
Extra tip
If you want info about Windows or Mac releases, you can try the following modules from sindresorhus:
or
License
-
Licensed under MIT
-
Copyright (c) 2018-2020 [Samuel Carreira]
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 0/16 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
29 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w
- Warn: Project is vulnerable to: GHSA-434g-2637-qmqr
- Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m
- Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw
- Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p
- Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j
- Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-px4h-xg32-q955
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
Score
1.7
/10
Last Scanned on 2025-01-20
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More