Skip to content

Commit

Permalink
Merge pull request #3 from aks-/add-str-support-with-write
Browse files Browse the repository at this point in the history
add string support for connection.write
  • Loading branch information
Ardalan Amini authored Jan 16, 2019
2 parents 90e22b8 + 4739ebb commit 0a68993
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0a68993

Please sign in to comment.