diff --git a/lib/connection.js b/lib/connection.js index f443a1c..c681c92 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -159,6 +159,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)