Archived
1
0
This repository has been archived on 2023-05-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
home-page/node_modules/nan/doc/string_bytes.md
Sean Edmunds 0584430b5c First commit
2021-12-13 17:00:40 -06:00

1.9 KiB

Strings & Bytes

Miscellaneous string & byte encoding and decoding functionality provided for compatibility across supported versions of V8 and Node. Implemented by NAN to ensure that all encoding types are supported, even for older versions of Node where they are missing.

Nan::Encoding

An enum representing the supported encoding types. A copy of node::encoding that is consistent across versions of Node.

Definition:

enum Nan::Encoding { ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER }

Nan::Encode()

A wrapper around node::Encode() that provides a consistent implementation across supported versions of Node.

Signature:

v8::Local<v8::Value> Nan::Encode(const void *buf,
                                 size_t len,
                                 enum Nan::Encoding encoding = BINARY);

Nan::DecodeBytes()

A wrapper around node::DecodeBytes() that provides a consistent implementation across supported versions of Node.

Signature:

ssize_t Nan::DecodeBytes(v8::Local<v8::Value> val,
                         enum Nan::Encoding encoding = BINARY);

Nan::DecodeWrite()

A wrapper around node::DecodeWrite() that provides a consistent implementation across supported versions of Node.

Signature:

ssize_t Nan::DecodeWrite(char *buf,
                         size_t len,
                         v8::Local<v8::Value> val,
                         enum Nan::Encoding encoding = BINARY);