diff --git a/lib/connection.js b/lib/connection.js index 3b3d35b..98e82e6 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -160,6 +160,7 @@ class Connection extends events.EventEmitter { } write (data, len, cb) { + if (typeof data === 'string') data = Buffer.from(data) if (typeof len === 'function') this._write(data, data.length, len) else if (!len) this._write(data, data.length, cb || noop) else this._write(data, len, cb || noop)