🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

fs-ext

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fs-ext - npm Package Compare versions

Comparing version

to
1.0.0

package-lock.json

50

fs-ext.js

@@ -35,15 +35,15 @@ // Permission is hereby granted, free of charge, to any person obtaining a

return binding.LOCK_SH;
case 'ex':
return binding.LOCK_EX;
case 'shnb':
return binding.LOCK_SH | binding.LOCK_NB;
case 'exnb':
return binding.LOCK_EX | binding.LOCK_NB;
case 'un':
return binding.LOCK_UN;
default:

@@ -63,6 +63,15 @@ throw new Error('Unknown flock flag: ' + flag);

return binding.F_GETFD;
case 'setfd':
return binding.F_SETFD;
case 'setlk':
return binding.F_SETLK;
case 'setlkw':
return binding.F_SETLKW;
case 'getlk':
return binding.F_GETLK;
default:

@@ -121,29 +130,2 @@ throw new Error('Unknown fcntl flag: ' + flag);

// fs.utime('foo' [, atime, mtime] [, func] )
exports.utime = function(path, atime, mtime, callback) {
callback = arguments[arguments.length - 1];
if (typeof(callback) !== 'function') {
callback = noop;
}
if (typeof(atime) !== 'number' && typeof(mtime) !== 'number') {
atime = mtime = Date.now() / 1000;
}
binding.utime(path, atime, mtime, callback);
};
// fs.utimeSync('foo' [, atime, mtime] )
exports.utimeSync = function(path, atime, mtime) {
if (typeof(atime) !== 'number' && typeof(mtime) !== 'number') {
atime = mtime = Date.now() / 1000;
}
return binding.utime(path, atime, mtime);
};
exports.statVFS = function(path, callback) {

@@ -150,0 +132,0 @@ path = path || '/';

@@ -5,4 +5,9 @@ {

"description": "Extensions to core 'fs' module.",
"keywords": ["fs", "filesystem", "flock", "seek"],
"version": "0.6.0",
"keywords": [
"fs",
"filesystem",
"flock",
"seek"
],
"version": "1.0.0",
"homepage": "https://github.com/baudehlo/node-fs-ext/",

@@ -15,21 +20,25 @@ "repository": {

"engines": {
"node": ">= v0.8.0"
"node": ">= 6.0.0"
},
"dependencies": { "nan": "^2.0" },
"licenses": [ {
"type": "MIT"
} ],
"dependencies": {
"nan": "^2.0"
},
"licenses": [
{
"type": "MIT"
}
],
"bugs": {
"mail" : "helpme@gmail.com",
"web" : "https://github.com/baudehlo/node-fs-ext/issues"
"mail": "helpme@gmail.com",
"web": "https://github.com/baudehlo/node-fs-ext/issues"
},
"scripts": {
"scripts": {
"install": "node-gyp configure build",
"test": "./run_tests",
"test": "node ./run_tests",
"lint": "node ./node_modules/eslint/bin/eslint \"*.js\" \"tests/**/*.js\"",
"cover": "NODE_ENV=cov ./node_modules/.bin/istanbul cover _mocha"
"cover": "NODE_ENV=cov ./node_modules/.bin/istanbul cover node ./run_tests"
},
"devDependencies": {
"eslint" : "^2.13.0"
"eslint": "^2.13.0"
}
}
fs-ext
======
[![Build Status][ci-img]][ci-url]
[![Coverage Status][cov-img]][cov-url]
[![Windows Status][ci-win-img]][ci-win-url]
Extras not included in Node's fs module.
**Note**: From v1.0.0 onwards, fs.utime and fs.utimeSync have been removed.
Use fs.utimes and fs.utimesSync instead.
Installation

@@ -41,2 +48,7 @@ ------------

NOTE (from flock() man page): flock() does not lock files over NFS. Use fcntl(2)
instead: that does work over NFS, given a sufficiently recent version of Linux
and a server which supports locking.
### fs.flockSync(fd, flags)

@@ -56,5 +68,17 @@

- 'setfd' ( F_SETFD )
- 'setlk' ( F_SETLK )
- 'getlk' ( F_GETLK )
- 'setlkw' ( F_SETLKW )
Requiring this module adds `FD_CLOEXEC` to the constants module, for use with F_SETFD.
Requiring this module adds `FD_CLOEXEC` to the constants module, for use with F_SETFD,
and also F_RDLCK, F_WRLCK and F_UNLCK for use with F_SETLK (etc).
File locking can be used like so:
fs.fcntl(fd, 'setlkw', constants.F_WRLCK, function(err, result) {
if (result!=null) {
//Lock succeeded
}
});
### fs.fcntlSync(fd, flags)

@@ -81,19 +105,8 @@

### fs.utime(path [, atime, mtime] [, callback])
Asynchronous utime(2).
Arguments `atime` and `mtime` are in seconds as for the system call. Note
that the number value of Date() is in milliseconds, so to use the 'now'
value with `fs.utime()` you would have to divide by 1000 first, e.g.
Date.now()/1000
Just like for utime(2), the absence of the `atime` and `mtime` means 'now'.
### fs.utimeSync(path [, atime, mtime])
Synchronous version of utime(). Throws an exception on error.
[ci-img]: https://travis-ci.org/baudehlo/node-fs-ext.svg?branch=master
[ci-url]: https://travis-ci.org/baudehlo/node-fs-ext
[cov-img]: https://codecov.io/github/baudehlo/node-fs-ext/coverage.svg
[cov-url]: https://codecov.io/github/baudehlo/node-fs-ext?branch=master
[ci-win-img]: https://ci.appveyor.com/api/projects/status/pqbnutckk0n46uc8?svg=true
[ci-win-url]: https://ci.appveyor.com/project/baudehlo/node-fs-ext/branch/master

@@ -12,3 +12,4 @@ "use strict";

util = require('util'),
fs = require('../fs-ext');
fs = require('../fs-ext'),
os = require('os');

@@ -20,3 +21,3 @@ var tests_ok = 0,

var tmp_dir = "/tmp",
var tmp_dir = os.tmpdir(),
file_path = path.join(tmp_dir, 'what.when.fcntl.test');

@@ -75,3 +76,3 @@

else {
console.log('FAILURE: ' + arguments.callee.name + ': ' + fault_msg);
console.log('FAILURE: ' + fault_msg);
console.log(' ARGS: ', util.inspect(arguments));

@@ -93,3 +94,3 @@ }

else {
console.log('FAILURE: ' + arguments.callee.name + ': ' + fault_msg);
console.log('FAILURE: ' + fault_msg);
console.log(' ARGS: ', util.inspect(arguments));

@@ -96,0 +97,0 @@ }

@@ -27,3 +27,4 @@ "use strict";

util = require('util'),
fs = require('../fs-ext');
fs = require('../fs-ext'),
os = require('os');

@@ -35,3 +36,3 @@ var tests_ok = 0,

var tmp_dir = "/tmp",
var tmp_dir = os.tmpdir(),
file_path = path.join(tmp_dir, 'what.when.flock.test'),

@@ -82,5 +83,5 @@ file_path_not = path.join(tmp_dir, 'what.not.flock.test');

console.log(' memory: heapUsed %d rss %d',
usage.heapUsed, usage.rss);
usage.heapUsed, usage.rss);
console.log(' heapTotal %d vsize %d',
usage.heapTotal, usage.vsize);
usage.heapTotal, usage.vsize);
}

@@ -105,3 +106,3 @@

else {
console.log('FAILURE: ' + arguments.callee.name + ': ' + fault_msg);
console.log('FAILURE: ' + fault_msg);
console.log(' ARGS: ', util.inspect(arguments));

@@ -123,3 +124,3 @@ }

else {
console.log('FAILURE: ' + arguments.callee.name + ': ' + fault_msg);
console.log('FAILURE: ' + fault_msg);
console.log(' ARGS: ', util.inspect(arguments));

@@ -126,0 +127,0 @@ console.log(' err: %j', err );

@@ -29,3 +29,4 @@ "use strict";

util = require('util'),
fs = require('../fs-ext');
fs = require('../fs-ext'),
os = require('os');

@@ -37,3 +38,3 @@ var tests_ok = 0,

var tmp_dir = "/tmp",
var tmp_dir = os.tmpdir(),
file_path = path.join(tmp_dir, 'what.when.flock.test'),

@@ -93,3 +94,3 @@ file_path_not = path.join(tmp_dir, 'what.not.flock.test');

else {
console.log('FAILURE: ' + arguments.callee.name + ': ' + fault_msg);
console.log('FAILURE: ' + fault_msg);
console.log(' ARGS: ', util.inspect(arguments));

@@ -111,3 +112,3 @@ }

else {
console.log('FAILURE: ' + arguments.callee.name + ': ' + fault_msg);
console.log('FAILURE: ' + fault_msg);
console.log(' ARGS: ', util.inspect(arguments));

@@ -399,3 +400,9 @@ }

fs.flock(file_fd, 'exnb', function(err) {
expect_ok('flock', file_fd, err);
if (process.platform === 'win32') {
// Windows doesn't support lock upgrades
expect_errno('flock', 10035, err, 'EWOULDBLOCK');
}
else {
expect_ok('flock', file_fd, err);
}

@@ -402,0 +409,0 @@ tests_run++;

@@ -31,3 +31,4 @@ "use strict";

util = require('util'),
fs = require('../fs-ext');
fs = require('../fs-ext'),
os = require('os');

@@ -40,3 +41,3 @@ var tests_ok = 0,

var tmp_dir = "/tmp",
var tmp_dir = os.tmpdir(),
file_path = path.join(tmp_dir, 'what.when.seek.test'),

@@ -88,5 +89,5 @@ file_path_not = path.join(tmp_dir, 'what.not.seek.test');

console.log(' memory: heapUsed %d rss %d',
usage.heapUsed, usage.rss);
usage.heapUsed, usage.rss);
console.log(' heapTotal %d vsize %d',
usage.heapTotal, usage.vsize);
usage.heapTotal, usage.vsize);
}

@@ -116,3 +117,3 @@

else {
console.log('FAILURE: ' + arguments.callee.name + ': ' + fault_msg);
console.log('FAILURE: ' + fault_msg);
console.log(' ARGS: ', util.inspect(arguments));

@@ -154,3 +155,3 @@ }

else {
console.log('FAILURE: ' + arguments.callee.name + ': ' + fault_msg);
console.log('FAILURE: ' + fault_msg);
if (debug_me) console.log(' ARGS: ', util.inspect(arguments));

@@ -157,0 +158,0 @@ }

@@ -50,3 +50,4 @@ "use strict";

util = require('util'),
fs = require('../fs-ext');
fs = require('../fs-ext'),
os = require('os');

@@ -59,3 +60,3 @@ var tests_ok = 0,

var tmp_dir = "/tmp",
var tmp_dir = os.tmpdir(),
file_path = path.join(tmp_dir, 'what.when.seek.test'),

@@ -129,3 +130,3 @@ file_path_not = path.join(tmp_dir, 'what.not.seek.test');

else {
console.log('FAILURE: ' + arguments.callee.name + ': ' + fault_msg);
console.log('FAILURE: ' + fault_msg);
console.log(' ARGS: ', util.inspect(arguments));

@@ -169,4 +170,4 @@ }

else {
console.log('FAILURE: ' + arguments.callee.name + ': ' + fault_msg);
if (debug_me) console.log(' ARGS: ', util.inspect(arguments));
console.log('FAILURE: ' + fault_msg);
console.log(' ARGS: ', util.inspect(arguments));
}

@@ -213,4 +214,4 @@ }

else {
console.log('FAILURE: ' + arguments.callee.name + ': ' + fault_msg);
if (debug_me) console.log(' ARGS: ', util.inspect(arguments));
console.log('FAILURE: ' + fault_msg);
console.log(' ARGS: ', util.inspect(arguments));
}

@@ -217,0 +218,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet