Skip to content

Commit b8a51d3

Browse files
chore(release): 4.3.0 [skip ci]
# [4.3.0](v4.2.0...v4.3.0) (2020-08-12) ### Features * Add socket.setEncoding() method ([#74](#74)) ([bfa80ea](bfa80ea))
1 parent bfa80ea commit b8a51d3

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# [4.3.0](https://github.com/Rapsssito/react-native-tcp-socket/compare/v4.2.0...v4.3.0) (2020-08-12)
2+
3+
4+
### Features
5+
6+
* Add socket.setEncoding() method ([#74](https://github.com/Rapsssito/react-native-tcp-socket/issues/74)) ([bfa80ea](https://github.com/Rapsssito/react-native-tcp-socket/commit/bfa80ea3b690f8a486882b4921397633957f4686))
7+
18
# [4.2.0](https://github.com/Rapsssito/react-native-tcp-socket/compare/v4.1.0...v4.2.0) (2020-07-06)
29

310

coverage/coverage-final.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

lib/types/TcpServer.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export default class TcpServer extends TcpSocket {
4242
tlsCert?: any;
4343
}, callback?: ((address: string) => void) | undefined): TcpServer;
4444
setTimeout(timeout: number, callback?: (() => void) | undefined): TcpServer;
45+
setEncoding(encoding?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | undefined): TcpServer;
4546
setNoDelay(noDelay?: boolean): TcpServer;
4647
setKeepAlive(enable?: boolean, initialDelay?: number): TcpServer;
4748
addListener(event: string | symbol, listener: (...args: any[]) => void): TcpServer;

lib/types/TcpSocket.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default class TcpSocket extends EventEmitter {
2828
_timeout: NodeJS.Timeout | undefined;
2929
/** @type {number} */
3030
_state: number;
31+
_encoding: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | undefined;
3132
/**
3233
* @protected
3334
*/
@@ -80,6 +81,16 @@ export default class TcpSocket extends EventEmitter {
8081
* @private
8182
*/
8283
private _clearTimeout;
84+
/**
85+
* Set the encoding for the socket as a Readable Stream. By default, no encoding is assigned and stream data will be returned as `Buffer` objects.
86+
* Setting an encoding causes the stream data to be returned as strings of the specified encoding rather than as Buffer objects.
87+
*
88+
* For instance, calling `socket.setEncoding('utf8')` will cause the output data to be interpreted as UTF-8 data, and passed as strings.
89+
* Calling `socket.setEncoding('hex')` will cause the data to be encoded in hexadecimal string format.
90+
*
91+
* @param {BufferEncoding} [encoding]
92+
*/
93+
setEncoding(encoding?: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex" | undefined): TcpSocket;
8394
/**
8495
* Enable/disable the use of Nagle's algorithm. When a TCP connection is created, it will have Nagle's algorithm enabled.
8596
*

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-native-tcp-socket",
33
"title": "React Native Tcp Socket",
4-
"version": "4.2.0",
4+
"version": "4.3.0",
55
"description": "React Native TCP socket API for Android & iOS with SSL/TLS support",
66
"main": "src/index.js",
77
"types": "lib/types/index.d.ts",

0 commit comments

Comments
 (0)