napi_get_value_bigint_int64
napi_status napi_get_value_bigint_int64(napi_env env,
napi_value value,
int64_t* result,
bool* lossless); -
[in] env:调用 API 的环境¥
[in] env: The environment that the API is invoked under -
[in] value:napi_value代表 JavaScriptBigInt。¥
[in] value:napi_valuerepresenting JavaScriptBigInt. -
[out] result:给定的 JavaScriptBigInt的 Cint64_t基础类型等价物。¥
[out] result: Cint64_tprimitive equivalent of the given JavaScriptBigInt. -
[out] lossless:指示BigInt值是否已无损转换。¥
[out] lossless: Indicates whether theBigIntvalue was converted losslessly.
如果 API 成功,则返回 napi_ok。如果传入非 BigInt,则返回 napi_bigint_expected。
¥Returns napi_ok if the API succeeded. If a non-BigInt is passed in it
returns napi_bigint_expected.
此 API 返回给定 JavaScript BigInt 的 C int64_t 基础类型等价物。如果需要,它将截断该值,将 lossless 设置为 false。
¥This API returns the C int64_t primitive equivalent of the given JavaScript
BigInt. If needed it will truncate the value, setting lossless to false.