fetch-node-release
Fetch latest Node.js release version by keyword such as stable
, lts/carbon
or lts/*
.
Usage
const fetch = require('fetch-node-release');
(async () => {
let version;
version = await fetch('stable');
console.log('latest stable', version);
version = await fetch('lts/boron');
console.log('latest lts/boron', version);
version = await fetch('lts/*');
console.log('latest lts', version);
})().catch((err) => {
console.error(err);
process.exitCode = 1;
});
Caveats
- fetches data from
https://nodejs.org/dist/
so it will reject if there's no internet access or
upon HTTP failures - will reject if you provide invalid lts branch name
- will explode the moment node lts releases run out of alphabet ;)