Reorder method order to match node's lib/fs.js, document missing

This commit is contained in:
David Humphrey 2019-01-02 23:01:05 -05:00
parent c0acdb97d6
commit c6e1d51612
2 changed files with 84 additions and 68 deletions

View File

@ -2400,43 +2400,51 @@ function ftruncate(context, fd, length, callback) {
} }
module.exports = { module.exports = {
appendFile,
access,
chown,
chmod,
close,
// copyFile - https://github.com/filerjs/filer/issues/436
ensureRootDirectory: ensure_root_directory, ensureRootDirectory: ensure_root_directory,
open: open, exists,
chmod: chmod, fchown,
access: access, fchmod,
fchmod: fchmod, // fdatasync - https://github.com/filerjs/filer/issues/653
chown: chown, fgetxattr,
fchown: fchown, fremovexattr,
close: close, fsetxattr,
mknod: mknod, fstat,
mkdir: mkdir, fsync,
mkdtemp: mkdtemp, ftruncate,
rmdir: rmdir, futimes,
unlink: unlink, getxattr,
stat: stat, // lchown - https://github.com/filerjs/filer/issues/620
fstat: fstat, // lchmod - https://github.com/filerjs/filer/issues/619
link: link, link,
fsync: fsync, lseek,
read: read, lstat,
readFile: readFile, mkdir,
write: write, mkdtemp,
writeFile: writeFile, mknod,
appendFile: appendFile, open,
exists: exists, readdir,
getxattr: getxattr, read,
fgetxattr: fgetxattr, readFile,
setxattr: setxattr, readlink,
fsetxattr: fsetxattr, // realpath - https://github.com/filerjs/filer/issues/85
removexattr: removexattr, removexattr,
fremovexattr: fremovexattr, rename,
lseek: lseek, rmdir,
readdir: readdir, setxattr,
utimes: utimes, stat,
futimes: futimes, symlink,
rename: rename, truncate,
symlink: symlink, // unwatchFile - implemented in interface.js
readlink: readlink, unlink,
lstat: lstat, utimes,
truncate: truncate, // watch - implemented in interface.js
ftruncate: ftruncate // watchFile - implemented in interface.js
writeFile,
write
}; };

View File

@ -317,44 +317,52 @@ function FileSystem(options, callback) {
* can be processed and validated before being passed on to the method. * can be processed and validated before being passed on to the method.
*/ */
[ [
{ name: 'open', promises: true, absPathArgs: [ 0 ] }, { name: 'appendFile', promises: true, absPathArgs: [ 0 ] },
{ name: 'access', promises: true, absPathArgs: [ 0 ] }, { name: 'access', promises: true, absPathArgs: [ 0 ] },
{ name: 'chmod', promises: true, absPathArgs: [ 0 ] },
{ name: 'fchmod' },
{ name: 'chown', promises: true, absPathArgs: [ 0 ] }, { name: 'chown', promises: true, absPathArgs: [ 0 ] },
{ name: 'fchown' }, { name: 'chmod', promises: true, absPathArgs: [ 0 ] },
{ name: 'close' }, { name: 'close' },
{ name: 'mknod', promises: true, absPathArgs: [ 0 ] }, // copyFile - https://github.com/filerjs/filer/issues/436
{ name: 'mkdir', promises: true, absPathArgs: [ 0 ] }, { name: 'exists', absPathArgs: [ 0 ] },
{ name: 'mkdtemp', promises: true }, { name: 'fchown' },
{ name: 'rmdir', promises: true, absPathArgs: [ 0 ] }, { name: 'fchmod' },
{ name: 'stat', promises: true, absPathArgs: [ 0 ] }, // fdatasync - https://github.com/filerjs/filer/issues/653
{ name: 'fgetxattr' },
{ name: 'fremovexattr' },
{ name: 'fsetxattr' },
{ name: 'fstat' }, { name: 'fstat' },
{ name: 'fsync' }, { name: 'fsync' },
{ name: 'ftruncate' },
{ name: 'futimes' },
{ name: 'getxattr', promises: true, absPathArgs: [ 0 ] },
// lchown - https://github.com/filerjs/filer/issues/620
// lchmod - https://github.com/filerjs/filer/issues/619
{ name: 'link', promises: true, absPathArgs: [0, 1] }, { name: 'link', promises: true, absPathArgs: [0, 1] },
{ name: 'unlink', promises: true, absPathArgs: [ 0 ] }, { name: 'lseek' },
{ name: 'lstat', promises: true },
{ name: 'mkdir', promises: true, absPathArgs: [ 0 ] },
{ name: 'mkdtemp', promises: true },
{ name: 'mknod', promises: true, absPathArgs: [ 0 ] },
{ name: 'open', promises: true, absPathArgs: [ 0 ] },
{ name: 'readdir', promises: true, absPathArgs: [ 0 ] },
{ name: 'read' }, { name: 'read' },
{ name: 'readFile', promises: true, absPathArgs: [ 0 ] }, { name: 'readFile', promises: true, absPathArgs: [ 0 ] },
{ name: 'write' },
{ name: 'writeFile', promises: true, absPathArgs: [ 0 ] },
{ name: 'appendFile', promises: true, absPathArgs: [ 0 ] },
{ name: 'exists', absPathArgs: [ 0 ] },
{ name: 'lseek' },
{ name: 'readdir', promises: true, absPathArgs: [ 0 ] },
{ name: 'rename', promises: true, absPathArgs: [0, 1] },
{ name: 'readlink', promises: true, absPathArgs: [ 0 ] }, { name: 'readlink', promises: true, absPathArgs: [ 0 ] },
{ name: 'symlink', promises: true, relPathPargs: [ 0 ], absPathArgs: [ 1 ] }, // realpath - https://github.com/filerjs/filer/issues/85
{ name: 'lstat', promises: true },
{ name: 'truncate', promises: true, absPathArgs: [ 0 ] },
{ name: 'ftruncate' },
{ name: 'utimes', promises: true, absPathArgs: [ 0 ] },
{ name: 'futimes' },
{ name: 'setxattr', promises: true, absPathArgs: [ 0 ] },
{ name: 'getxattr', promises: true, absPathArgs: [ 0 ] },
{ name: 'fsetxattr' },
{ name: 'fgetxattr' },
{ name: 'removexattr', promises: true, absPathArgs: [ 0 ] }, { name: 'removexattr', promises: true, absPathArgs: [ 0 ] },
{ name: 'fremovexattr' } { name: 'rename', promises: true, absPathArgs: [0, 1] },
{ name: 'rmdir', promises: true, absPathArgs: [ 0 ] },
{ name: 'setxattr', promises: true, absPathArgs: [ 0 ] },
{ name: 'stat', promises: true, absPathArgs: [ 0 ] },
{ name: 'symlink', promises: true, relPathArgs: [ 0 ], absPathArgs: [ 1 ] },
{ name: 'truncate', promises: true, absPathArgs: [ 0 ] },
// unwatchFile - https://github.com/filerjs/filer/pull/553
{ name: 'unlink', promises: true, absPathArgs: [ 0 ] },
{ name: 'utimes', promises: true, absPathArgs: [ 0 ] },
// watch - implemented above in `this.watch`
// watchFile - https://github.com/filerjs/filer/issues/654
{ name: 'writeFile', promises: true, absPathArgs: [ 0 ] },
{ name: 'write' }
].forEach(function(method) { ].forEach(function(method) {
var methodName = method.name; var methodName = method.name;
var shouldPromisify = method.promises === true; var shouldPromisify = method.promises === true;
@ -373,8 +381,8 @@ function FileSystem(options, callback) {
if(method.absPathArgs) { if(method.absPathArgs) {
method.absPathArgs.forEach(pathArg => processPathArg(args, pathArg, false)); method.absPathArgs.forEach(pathArg => processPathArg(args, pathArg, false));
} }
if(method.relPathPargs) { if(method.relPathArgs) {
method.relPathPargs.forEach(pathArg => processPathArg(args, pathArg, true)); method.relPathArgs.forEach(pathArg => processPathArg(args, pathArg, true));
} }
var error = fs.queueOrRun(function() { var error = fs.queueOrRun(function() {