Parses an identifier from the files of a release in the
Node.js release index, such as
linux-x64 or osx-arm64-tar, into the file names it stands for, its
platform, and its architecture. @nodevu/core uses it for
release.files.
npm install @nodevu/parsefiles
Pass it an identifier and the version it belongs to:
const parsefiles = require('@nodevu/parsefiles'); parsefiles('linux-x64', '17.6.0'); // { // id: 'linux-x64', // files: ['node-v17.6.0-linux-x64.tar.gz', 'node-v17.6.0-linux-x64.tar.xz'], // type: 'linux', // architecture: 'x64', // }
parsefiles(file, version): Object
Attributes
file:
stringAn identifier from the release's
files, such as
'win-x64-msi'.version:
stringThe release's version, without its
v, such as
'17.6.0'.Returns:
Objectid:
stringThe identifier passed in.
files:
string[]The file names that should exist for the identifier.
There's often more than one.
type:
stringThe platform, or what kind of files these are:
'aix',
'headers', 'linux', 'macos', 'source', 'sunos', or
'windows'.architecture:
stringThe architecture, such as
'x64', 'x86',
'arm64', 'armv7l', 'armv6l', 'power', or 'z'. Not present for
identifiers without one, like 'src' and 'headers'.The file names follow the patterns nodejs.org has used so far. New kinds of identifiers can show up in the index before this module knows them.