Skip to content

Commit

Permalink
restore compatibility with node 0.10*
Browse files Browse the repository at this point in the history
Use Nan::To() in the necessary places.

Signed-off-by: John Levon <[email protected]>
  • Loading branch information
John Levon committed Jun 2, 2020
1 parent bc31f0b commit 1104451
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fs-ext
[![Coverage Status][cov-img]][cov-url]
[![Windows Status][ci-win-img]][ci-win-url]

Extras not included in Node's fs module.
Extras not included in Node's fs module. Supports Node 0.10 upwards.

**Note**:

Expand Down
14 changes: 7 additions & 7 deletions fs-ext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ static NAN_METHOD(Flock) {
store_data_t* flock_data = new store_data_t();

flock_data->fs_op = FS_OP_FLOCK;
flock_data->fd = info[0].As<v8::Int32>()->Value();
flock_data->oper = info[1].As<v8::Int32>()->Value();
flock_data->fd = Nan::To<int32_t>(info[0]).FromJust();
flock_data->oper = Nan::To<int32_t>(info[1]).FromJust();

if (info[2]->IsFunction()) {
flock_data->cb = new Nan::Callback((Local<Function>) info[2].As<Function>());
Expand Down Expand Up @@ -393,10 +393,10 @@ static NAN_METHOD(Seek) {
return THROW_BAD_ARGS;
}

int fd = info[0].As<v8::Int32>()->Value();
int fd = Nan::To<int32_t>(info[0]).FromJust();
ASSERT_OFFSET(info[1]);
off_t offs = GET_OFFSET(info[1]);
int whence = info[2].As<v8::Int32>()->Value();
int whence = Nan::To<int32_t>(info[2]).FromJust();

if ( ! info[3]->IsFunction()) {
#ifdef _WIN32
Expand Down Expand Up @@ -435,9 +435,9 @@ static NAN_METHOD(Fcntl) {
return THROW_BAD_ARGS;
}

int fd = info[0].As<v8::Int32>()->Value();
int cmd = info[1].As<v8::Int32>()->Value();
int arg = info[2].As<v8::Int32>()->Value();
int fd = Nan::To<int32_t>(info[0]).FromJust();
int cmd = Nan::To<int32_t>(info[1]).FromJust();
int arg = Nan::To<int32_t>(info[2]).FromJust();

if ( ! info[3]->IsFunction()) {
int result = fcntl(fd, cmd, arg);
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
"flock",
"seek"
],
"version": "2.0.1",
"version": "2.0.2",
"homepage": "https://github.com/baudehlo/node-fs-ext/",
"repository": {
"type": "git",
"url": "git://github.com/baudehlo/node-fs-ext.git"
},
"main": "fs-ext.js",
"engines": {
"node": ">= 8.0.0"
"node": ">= 0.10"
},
"dependencies": {
"nan": "^2.14.0"
Expand Down

0 comments on commit 1104451

Please sign in to comment.