Skip to content
This repository has been archived by the owner on May 27, 2019. It is now read-only.

Commit

Permalink
Replace Buffer.allocUnsafe() with new Buffer()
Browse files Browse the repository at this point in the history
Since Buffer.allocUnsafe() does not exist on Node before v5.10.0.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
  • Loading branch information
kevinoid committed Dec 13, 2016
1 parent 8387613 commit a186f5c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs-file-sync-fd.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function tryCreateBuffer(size, fd, isUserFd) {
var threw = true;
var buffer;
try {
buffer = Buffer.allocUnsafe(size);
buffer = new Buffer(size);
threw = false;
} finally {
if (threw && !isUserFd) fs.closeSync(fd);
Expand Down Expand Up @@ -108,7 +108,7 @@ fsFileSyncFD.readFileSync = function(path, options) {
do {
// the kernel lies about many files.
// Go ahead and try to read some bytes.
buffer = Buffer.allocUnsafe(8192);
buffer = new Buffer(8192);
bytesRead = tryReadSync(fd, isUserFd, buffer, 0, 8192);
if (bytesRead !== 0) {
buffers.push(buffer.slice(0, bytesRead));
Expand Down

0 comments on commit a186f5c

Please sign in to comment.