MCPcopy Create free account
hub / github.com/nodejs/nan / TryEncode

Function TryEncode

nan.h:2439–2456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2437
2438#if NODE_MAJOR_VERSION >= 24
2439inline MaybeLocal<v8::Value> TryEncode(
2440 const void *buf, size_t len, enum Encoding encoding = BINARY) {
2441 v8::Isolate* isolate = v8::Isolate::GetCurrent();
2442 node::encoding node_enc = static_cast<node::encoding>(encoding);
2443
2444 if (encoding == UCS2) {
2445 return node::TryEncode(
2446 isolate
2447 , reinterpret_cast<const uint16_t *>(buf)
2448 , len / 2);
2449 } else {
2450 return node::TryEncode(
2451 isolate
2452 , reinterpret_cast<const char *>(buf)
2453 , len
2454 , node_enc);
2455 }
2456}
2457
2458inline v8::Local<v8::Value> Encode(
2459 const void *buf, size_t len, enum Encoding encoding = BINARY) {

Callers 1

EncodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected