Blame view

node_modules/nan/doc/string_bytes.md 1.86 KB
2a09d1a4   liuqimichale   添加宜春 天水 宣化
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
  ## 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.
  
   - <a href="#api_nan_encoding"><b><code>Nan::Encoding</code></b></a>
   - <a href="#api_nan_encode"><b><code>Nan::Encode()</code></b></a>
   - <a href="#api_nan_decode_bytes"><b><code>Nan::DecodeBytes()</code></b></a>
   - <a href="#api_nan_decode_write"><b><code>Nan::DecodeWrite()</code></b></a>
  
  
  <a name="api_nan_encoding"></a>
  ### Nan::Encoding
  
  An enum representing the supported encoding types. A copy of `node::encoding` that is consistent across versions of Node.
  
  Definition:
  
  ```c++
  enum Nan::Encoding { ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER }
  ```
  
  
  <a name="api_nan_encode"></a>
  ### Nan::Encode()
  
  A wrapper around `node::Encode()` that provides a consistent implementation across supported versions of Node.
  
  Signature:
  
  ```c++
  v8::Local<v8::Value> Nan::Encode(const void *buf,
                                   size_t len,
                                   enum Nan::Encoding encoding = BINARY);
  ```
  
  
  <a name="api_nan_decode_bytes"></a>
  ### Nan::DecodeBytes()
  
  A wrapper around `node::DecodeBytes()` that provides a consistent implementation across supported versions of Node.
  
  Signature:
  
  ```c++
  ssize_t Nan::DecodeBytes(v8::Local<v8::Value> val,
                           enum Nan::Encoding encoding = BINARY);
  ```
  
  
  <a name="api_nan_decode_write"></a>
  ### Nan::DecodeWrite()
  
  A wrapper around `node::DecodeWrite()` that provides a consistent implementation across supported versions of Node.
  
  Signature:
  
  ```c++
  ssize_t Nan::DecodeWrite(char *buf,
                           size_t len,
                           v8::Local<v8::Value> val,
                           enum Nan::Encoding encoding = BINARY);
  ```