Skip to content

Commit

Permalink
Improve compatibility with node 0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
corollari committed Jul 9, 2020
1 parent 9974c5c commit 39bd44c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function readFileChunk(path:string, offset:number, length:number): Promise<locat
return new Promise(function (resolve, reject){
fs.open("data/"+path, 'r', function (err, fd){
if (err) reject(err);
const buf = Buffer.alloc(length)
const buf = Buffer.alloc == undefined? new Buffer(length) : Buffer.alloc(length)
fs.read(fd, buf, 0, length, offset, function(err, _, buffer){
fs.close(fd, function(){})
if(err) reject(err);
Expand Down

0 comments on commit 39bd44c

Please sign in to comment.