[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/native-library](https://jsprismarine.dev/api/@jsprismarine/native-library/index.md) / platform

# platform

## Type Aliases

### LinuxLibc

> **LinuxLibc** = `"gnu"` \| `"musl"`

Defined in: [platform.ts:5](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-library/src/platform.ts#L5)

The C library a Linux build is linked against.

## Functions

### installedLibraryFile()

> **installedLibraryFile**(`packageDir`, `platform`, `library`): `string`

Defined in: [platform.ts:95](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-library/src/platform.ts#L95)

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`](#linuxlibc)

Defined in: [platform.ts:12](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-library/src/platform.ts#L12)

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`](#linuxlibc)

`gnu` or `musl`.

***

### namingAnswers()

> **namingAnswers**(): `string`

Defined in: [platform.ts:106](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-library/src/platform.ts#L106)

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](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-library/src/platform.ts#L61)

The operating system a platform key is for.

#### Parameters

##### key

`string`

A key from [platformKey](#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](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-library/src/platform.ts#L35)

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`](#linuxlibc) = `...`

The C library, for Linux; ignored elsewhere.

#### Returns

`string`

The key.

***

### sharedLibraryFile()

> **sharedLibraryFile**(`library`, `platform?`): `string`

Defined in: [platform.ts:72](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-library/src/platform.ts#L72)

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](https://github.com/JSPrismarine/JSPrismarine/blob/9db8dc5e83d04708d63ff9d73cae14f6c6b880f6/packages/native-library/src/platform.ts#L84)

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.
