diff --git a/README.md b/README.md index 5db3793..5d72f56 100644 --- a/README.md +++ b/README.md @@ -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**: diff --git a/fs-ext.cc b/fs-ext.cc index 95088bd..3474772 100644 --- a/fs-ext.cc +++ b/fs-ext.cc @@ -242,11 +242,8 @@ static void EIO_Fcntl(uv_work_t *req) { store_data_t* data = static_cast(req->data); struct flock lk; - lk.l_start = 0; - lk.l_len = 0; - lk.l_type = 0; - lk.l_whence = 0; - lk.l_pid = 0; + + memset(&lk, '\0', sizeof (lk)); int result = -1; if (data->oper == F_GETLK || data->oper == F_SETLK || data->oper == F_SETLKW) { @@ -347,8 +344,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()->Value(); - flock_data->oper = info[1].As()->Value(); + flock_data->fd = Nan::To(info[0]).FromJust(); + flock_data->oper = Nan::To(info[1]).FromJust(); if (info[2]->IsFunction()) { flock_data->cb = new Nan::Callback((Local) info[2].As()); @@ -398,10 +395,10 @@ static NAN_METHOD(Seek) { return THROW_BAD_ARGS; } - int fd = info[0].As()->Value(); + int fd = Nan::To(info[0]).FromJust(); ASSERT_OFFSET(info[1]); off_t offs = GET_OFFSET(info[1]); - int whence = info[2].As()->Value(); + int whence = Nan::To(info[2]).FromJust(); if ( ! info[3]->IsFunction()) { #ifdef _WIN32 @@ -440,9 +437,9 @@ static NAN_METHOD(Fcntl) { return THROW_BAD_ARGS; } - int fd = info[0].As()->Value(); - int cmd = info[1].As()->Value(); - int arg = info[2].As()->Value(); + int fd = Nan::To(info[0]).FromJust(); + int cmd = Nan::To(info[1]).FromJust(); + int arg = Nan::To(info[2]).FromJust(); if ( ! info[3]->IsFunction()) { int result = fcntl(fd, cmd, arg); diff --git a/package-lock.json b/package-lock.json index d4bf8e0..c43da20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "fs-ext", - "version": "1.3.0", + "version": "2.0.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 157b375..3233347 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "flock", "seek" ], - "version": "2.0.0", + "version": "2.0.2", "homepage": "https://github.com/baudehlo/node-fs-ext/", "repository": { "type": "git", @@ -16,10 +16,10 @@ }, "main": "fs-ext.js", "engines": { - "node": ">= 8.0.0" + "node": ">= 0.10" }, "dependencies": { - "nan": "^2.14.0" + "nan": "~2.14.0" }, "licenses": [ {