@@ -22,12 +22,15 @@ This module provides follow function:
2222 Note: c/c++ data struct must one bit algin.
2323
2424## cppMsg.msg constructor overloads
25- - `new cppMsg.msg() create empty cppMsg;
26- - `new cppMsg.msg( ds ) ds is data struct define Array
27- - `new cppMsg.msg( ds, data) ds is data struct define Array. data(optional) is init json data.
25+ - ` new cppMsg.msg() ` create empty cppMsg;
26+ - ` new cppMsg.msg( ds ) ` ds is data struct define Array
27+ - ` new cppMsg.msg( ds, data) ` ds is data struct define Array. data(optional) is init json data.
28+ - ` new cppMsg.msg( ds, null, opts) ` ds is data struct define Array. data(optional) is init json data.
29+ * opts, {useIconv: true } ,useIconv ` boolean ` , maybe use iconv-lite convert code
2830
2931## cppMsg.msg methods
3032- encodeMsg( data ) : json data object;
33+ - encodeMsg2( data ) : json data object( use msg internal buffer, return internal buffer );
3134- decodeMsg( buf ) : decode Buffer to json data object;
3235
3336next methods using stream mode:
@@ -89,10 +92,10 @@ Nodejs code:
8992 [' testObj' ,' object' , msg_def .msgHead ], // nested other
9093 [' testint64' ,' int64' ],
9194 [' floatArray3' , ' float' , , , 3 ]
92- ]
95+ ], null , {useIconv : false }
9396 );
9497
95- var buff = msg .encodeMsg ( {
98+ var buff = msg .encodeMsg2 ( {
9699 reg : 2 ,
97100 chkCode : 0 ,
98101 iType : 2 ,
@@ -128,21 +131,30 @@ Nodejs code:
128131 console .log ( msg .encode ());
129132```
130133## Changelog
134+ ### 1.2.0
135+ 1 . add method ` encodeMsg2 ` , Improve performance 1x
136+ 1 . optimize performance encodeMsg
137+ 1 . optimize performance decodeMsg, Improve performance 1x
138+ 1 . change msg construct add params ` opts `
139+ * opts, `{useIconv: true }`
140+ * useIconv, `boolean`, true(default): use iconv-lite convert code.( false, __Improve performance__)
141+ 1 . Default string code,change to ` utf8 `
142+
131143### 1.1.0
132- 1 . Using ES6 syntax
133- 2 . optimize performance encodeMsg
144+ 1 . Using ES6 syntax
145+ 2 . optimize performance encodeMsg
134146
135147### 1.0.3
136- 1 . fix int64 decode/encode error( Works only for numbers <= Number.MAX_SAFE_INTEGER ).
137- 2 . fix object decode error.
148+ 1 . fix int64 decode/encode error( Works only for numbers <= Number.MAX_SAFE_INTEGER ).
149+ 2 . fix object decode error.
138150### 1.0.2
139- 1 . merge darnold79 change,add array support.
151+ 1 . merge darnold79 change,add array support.
140152
141153### 1.0.1
142- 1 . string type add encode support(using iconv-lite).
154+ 1 . string type add encode support(using iconv-lite).
143155
144156### 1.0.0
145- 1 . init.
157+ 1 . init.
146158
147159
148160## LICENSE
0 commit comments