Add support for fgetattr, symlink and fix listxattr args
This commit is contained in:
parent
9c2bf35bd2
commit
9b3914522d
3
index.js
3
index.js
@ -22,6 +22,9 @@ const ops = {
|
||||
setxattr: require('./ops/setxattr'),
|
||||
removexattr: require('./ops/removexattr'),
|
||||
listxattr: require('./ops/listxattr'),
|
||||
fgetattr: require('./ops/fgetattr'),
|
||||
symlink: require('./ops/symlink'),
|
||||
readlink: require('./ops/readlink'),
|
||||
}
|
||||
|
||||
;(async () => {
|
||||
|
25
ops/fgetattr.js
Normal file
25
ops/fgetattr.js
Normal file
@ -0,0 +1,25 @@
|
||||
const Fuse = require('fuse-native')
|
||||
const Errors = require('../../shared/Errors')
|
||||
const Message = require('../../shared/Message')
|
||||
const connector = require('../connector')
|
||||
|
||||
module.exports = exports = function (path, fd, cb) {
|
||||
connector.send(
|
||||
Message.route('fs.fgetattr')
|
||||
.data({ path, descriptor: fd })
|
||||
.expect_response(msg => {
|
||||
if ( msg.error() ) {
|
||||
return Errors.toCallback(cb, msg.error())
|
||||
}
|
||||
|
||||
const { node } = msg.data()
|
||||
|
||||
delete node.pied_name
|
||||
node.mtime = new Date(node.mtime)
|
||||
node.atime = new Date(node.atime)
|
||||
node.ctime = new Date(node.ctime)
|
||||
|
||||
return process.nextTick(cb, 0, node)
|
||||
})
|
||||
)
|
||||
}
|
@ -3,10 +3,10 @@ const Errors = require('../../shared/Errors')
|
||||
const Message = require('../../shared/Message')
|
||||
const connector = require('../connector')
|
||||
|
||||
module.exports = exports = function (path, name, cb) {
|
||||
module.exports = exports = function (path, cb) {
|
||||
connector.send(
|
||||
Message.route('fs.xattr.list')
|
||||
.data({ path, name })
|
||||
.data({ path })
|
||||
.expect_response(msg => {
|
||||
if ( msg.error() ) {
|
||||
return Errors.toCallback(cb, msg.error())
|
||||
|
19
ops/readlink.js
Normal file
19
ops/readlink.js
Normal file
@ -0,0 +1,19 @@
|
||||
const Fuse = require('fuse-native')
|
||||
const Errors = require('../../shared/Errors')
|
||||
const Message = require('../../shared/Message')
|
||||
const connector = require('../connector')
|
||||
|
||||
module.exports = exports = function (path, cb) {
|
||||
connector.send(
|
||||
Message.route('fs.readlink')
|
||||
.data({ path })
|
||||
.expect_response(msg => {
|
||||
if ( msg.error() ) {
|
||||
return Errors.toCallback(cb, msg.error())
|
||||
}
|
||||
|
||||
const { link } = msg.data()
|
||||
return process.nextTick(cb, 0, link)
|
||||
})
|
||||
)
|
||||
}
|
25
ops/symlink.js
Normal file
25
ops/symlink.js
Normal file
@ -0,0 +1,25 @@
|
||||
const Fuse = require('fuse-native')
|
||||
const Errors = require('../../shared/Errors')
|
||||
const Message = require('../../shared/Message')
|
||||
const connector = require('../connector')
|
||||
|
||||
module.exports = exports = function (src, dest, cb) {
|
||||
connector.send(
|
||||
Message.route('fs.symlink')
|
||||
.data({ source: src, destination: dest })
|
||||
.expect_response(msg => {
|
||||
if ( msg.error() ) {
|
||||
return Errors.toCallback(cb, msg.error())
|
||||
}
|
||||
|
||||
const { node } = msg.data()
|
||||
|
||||
delete node.pied_name
|
||||
node.mtime = new Date(node.mtime)
|
||||
node.atime = new Date(node.atime)
|
||||
node.ctime = new Date(node.ctime)
|
||||
|
||||
return process.nextTick(cb, 0)
|
||||
})
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue
Block a user