Skip to content

API reference / @jsprismarine/native-worldgen / embed

embed ​

Functions ​

libraryForPlatform() ​

libraryForPlatform(platform): Promise<Uint8Array<ArrayBufferLike> | undefined>

Defined in: embed.ts:10

The bytes of a platform's library, for a packager to embed in an executable: the build in the package if it is the published one or a local build:native, else the published build, downloaded and checked.

Parameters ​

platform ​

string

The platform key the executable is for.

Returns ​

Promise<Uint8Array<ArrayBufferLike> | undefined>

The library, or undefined when there is no build for that platform.


libraryForPlatform() ​

libraryForPlatform(platform): Promise<Uint8Array<ArrayBufferLike> | undefined>

Defined in: script-host/src/embed.ts:10

The bytes of a platform's library, for a packager to embed in an executable: the build in the package if it is the published one or a local build:native, else the published build, downloaded and checked.

Parameters ​

platform ​

string

The platform key the executable is for.

Returns ​

Promise<Uint8Array<ArrayBufferLike> | undefined>

The library, or undefined when there is no build for that platform.


provideEmbeddedLibrary() ​

provideEmbeddedLibrary(library, cacheDir, env?): string

Defined in: embed.ts:22

Writes an embedded library to a cache directory under its digest, and points JSP_NATIVE_WORLDGEN_LIBRARY at it, unless the user already set it. An operating system loads a shared library only from a file, so an executable has to write it once.

Parameters ​

library ​

Uint8Array

The embedded bytes.

cacheDir ​

string

A writable directory.

env? ​

ProcessEnv

The environment to set the variable in.

Returns ​

string

The file's path.


provideEmbeddedLibrary() ​

provideEmbeddedLibrary(library, cacheDir, env?): string

Defined in: script-host/src/embed.ts:22

Writes an embedded library to a cache directory under its digest, and points JSP_SCRIPT_HOST_LIBRARY at it, unless the user already set it. An operating system loads a shared library only from a file, so an executable has to write it once.

Parameters ​

library ​

Uint8Array

The embedded bytes.

cacheDir ​

string

A writable directory.

env? ​

ProcessEnv

The environment to set the variable in.

Returns ​

string

The file's path.