@bobfrankston/iflow 1.0.52 → 1.0.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,7 @@
5
5
  import type { ImapTransport } from "./transport.js";
6
6
  export declare class NodeTransport implements ImapTransport {
7
7
  private socket;
8
+ private decoder;
8
9
  private dataHandler;
9
10
  private closeHandler;
10
11
  private errorHandler;
@@ -4,8 +4,10 @@
4
4
  */
5
5
  import * as net from "node:net";
6
6
  import * as tls from "node:tls";
7
+ import { StringDecoder } from "node:string_decoder";
7
8
  export class NodeTransport {
8
9
  socket = null;
10
+ decoder = new StringDecoder("utf-8");
9
11
  dataHandler = null;
10
12
  closeHandler = null;
11
13
  errorHandler = null;
@@ -40,7 +42,7 @@ export class NodeTransport {
40
42
  // Wire up persistent handlers after connect
41
43
  this.socket.on("data", (chunk) => {
42
44
  if (this.dataHandler)
43
- this.dataHandler(chunk.toString("utf-8"));
45
+ this.dataHandler(this.decoder.write(chunk));
44
46
  });
45
47
  this.socket.on("close", (hadError) => {
46
48
  this._connected = false;
@@ -64,10 +66,11 @@ export class NodeTransport {
64
66
  rejectUnauthorized: this.rejectUnauthorized,
65
67
  }, () => {
66
68
  this.socket = tlsSocket;
69
+ this.decoder = new StringDecoder("utf-8");
67
70
  // Re-wire data handler to new socket
68
71
  tlsSocket.on("data", (chunk) => {
69
72
  if (this.dataHandler)
70
- this.dataHandler(chunk.toString("utf-8"));
73
+ this.dataHandler(this.decoder.write(chunk));
71
74
  });
72
75
  tlsSocket.on("close", (hadError) => {
73
76
  this._connected = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/iflow",
3
- "version": "1.0.52",
3
+ "version": "1.0.53",
4
4
  "description": "IMAP client wrapper library",
5
5
  "main": "index.js",
6
6
  "types": "index.ts",