Skip to content

@pumpkin-plugins/plugin-kit API / wasi-number / toSafeNumber

Function: toSafeNumber() ​

toSafeNumber(value, label): number

Defined in: tools/plugin-kit/src/wasi-number.ts:7

Converts a WASI u64, which arrives as a bigint, to a number.

Parameters ​

value ​

bigint

The value from a WASI call, such as a file size or a writable byte count.

label ​

string

What the value is, for the error message.

Returns ​

number

Throws ​

When the value is negative or above Number.MAX_SAFE_INTEGER.

pumpkin-plugins documentation