diff --git a/lib/readline-sync.js b/lib/readline-sync.js index 35fcb3a..722426f 100644 --- a/lib/readline-sync.js +++ b/lib/readline-sync.js @@ -361,7 +361,11 @@ function _readlineSync(options) { input = tryExt(); return; } - buffer = new Buffer((reqSize = options.keyIn ? 1 : options.bufferSize)); + if (Buffer.alloc) { + buffer = Buffer.alloc((reqSize = options.keyIn ? 1 : options.bufferSize)); + } else { + buffer = new Buffer((reqSize = options.keyIn ? 1 : options.bufferSize)); + } if (options.keyIn && options.limit) { limit = new RegExp('[^' + options.limit + ']',