Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
Rahul Padigela | 5890c69d13 | |
Rahul Padigela | c8d5d8ba7b | |
Rahul Padigela | 5a1afee140 |
|
@ -1,2 +0,0 @@
|
|||
build
|
||||
node_modules
|
|
@ -7,10 +7,6 @@ fs.open('foo', 'w+', function(err, fd) {
|
|||
}
|
||||
|
||||
ret = posixFadvise(fd, 0, 10, 4);
|
||||
console.log('posixFadvise ret:', ret);
|
||||
fs.close(fd, err => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
console.log('posixFadvise ret: ' + ret);
|
||||
fs.close(fd);
|
||||
});
|
||||
|
|
17
package.json
17
package.json
|
@ -1,14 +1,11 @@
|
|||
{
|
||||
"name": "fcntl",
|
||||
"version": "0.2.1",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"version": "0.1.0",
|
||||
"description": "fcntl wrapper for nodejs",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"install": "node-gyp rebuild",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"install": "node-gyp rebuild"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -25,9 +22,13 @@
|
|||
"url": "https://github.com/scality/node-fcntl/issues"
|
||||
},
|
||||
"homepage": "https://github.com/scality/node-fcntl#readme",
|
||||
"gypfile": true,
|
||||
"dependencies": {
|
||||
"bindings": "^1.1.1",
|
||||
"nan": "^2.3.2",
|
||||
"node-gyp": "^8.0.0"
|
||||
"nan": "^2.3.2"
|
||||
},
|
||||
"scripts": {
|
||||
"install": "node-gyp rebuild",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,10 +36,10 @@ NAN_METHOD(PosixFadvise) {
|
|||
Nan::ThrowTypeError("Argument 1 Must be an Integer");
|
||||
}
|
||||
|
||||
int fd = info[0]->Int32Value(Nan::GetCurrentContext()).FromJust();
|
||||
off_t offset = (off_t) info[1]->NumberValue(Nan::GetCurrentContext()).FromJust();
|
||||
off_t len = (off_t) info[2]->NumberValue(Nan::GetCurrentContext()).FromJust();
|
||||
unsigned long advice = info[3]->IntegerValue(Nan::GetCurrentContext()).FromJust();
|
||||
int fd = info[0]->Int32Value();
|
||||
off_t offset = (off_t) info[1]->NumberValue();
|
||||
off_t len = (off_t) info[2]->NumberValue();
|
||||
unsigned long advice = info[3]->IntegerValue();
|
||||
|
||||
int res = posix_fadvise(fd, offset, len, advice);
|
||||
if (res < 0) {
|
||||
|
|
Loading…
Reference in New Issue