Skip to content

API reference / @jsprismarine/native-library / platform

platform ​

Type Aliases ​

LinuxLibc ​

LinuxLibc = "gnu" | "musl"

Defined in: platform.ts:5

The C library a Linux build is linked against.

Functions ​

installedLibraryFile() ​

installedLibraryFile(packageDir, platform, library): string

Defined in: platform.ts:95

Where a platform's library goes in its package, whether build:native built it or the install script downloaded it.

Parameters ​

packageDir ​

string

The package's directory.

platform ​

string

The platform key.

library ​

string

The library's name without its extension.

Returns ​

string

prebuilds/<platform>/<library file> under it.


linuxLibc() ​

linuxLibc(): LinuxLibc

Defined in: platform.ts:12

Which C library this Linux process runs on. Node.js reports glibc's version in its process report and leaves it out under musl; Bun has no report, so the loader's name decides there.

Returns ​

LinuxLibc

gnu or musl.


namingAnswers() ​

namingAnswers(): string

Defined in: platform.ts:106

What the naming helpers above answer for each machine a release builds on, for nativeSourceHash. A build script calls them to name its output and, on macOS, to set the library's install name, so these answers are what this module contributes to a build. The hash covers the answers rather than this file's text, so a refactor, or a change for a platform no release builds on, publishes no new builds.

Returns ​

string

One line per operating system, processor and C library.


operatingSystemOf() ​

operatingSystemOf(key): Platform

Defined in: platform.ts:61

The operating system a platform key is for.

Parameters ​

key ​

string

A key from platformKey, such as linux-x64-gnu.

Returns ​

Platform

The operating system, as process.platform names it.


platformKey() ​

platformKey(platform?, arch?, libc?): string

Defined in: platform.ts:35

The key a build of a native library is published under, such as linux-x64-gnu.

Parameters ​

platform? ​

Platform = process.platform

The operating system, as process.platform names it.

arch? ​

string = process.arch

The processor, as process.arch names it.

libc? ​

LinuxLibc = ...

The C library, for Linux; ignored elsewhere.

Returns ​

string

The key.


sharedLibraryFile() ​

sharedLibraryFile(library, platform?): string

Defined in: platform.ts:72

The file name of a shared library on an operating system.

Parameters ​

library ​

string

The library's name without its extension, such as libjsp_native_network.

platform? ​

Platform = process.platform

The operating system, as process.platform names it.

Returns ​

string

The file name.


staticLibraryFile() ​

staticLibraryFile(library, platform?): string

Defined in: platform.ts:84

The file name of the static archive a scriptc build links.

Parameters ​

library ​

string

The library's name without its extension.

platform? ​

Platform = process.platform

The operating system, as process.platform names it.

Returns ​

string

The file name.