Skip to content

Commit

Permalink
add string support for connection.write
Browse files Browse the repository at this point in the history
  • Loading branch information
aks- committed Mar 24, 2018
1 parent 073b99c commit 4739ebb
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 @@ -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)
Expand Down

0 comments on commit 4739ebb

Please sign in to comment.