server/app/ws/routes/fs.xattr.list.js

20 lines
570 B
JavaScript
Raw Normal View History

2020-11-27 18:15:11 +00:00
const { Errors } = require('../../shared')
module.exports = exports = async (message, di) => {
const Node = di.models.get('fs:Node')
const { path } = message.data()
const node = await Node.get_path(path, message.socket.session.overlay_name || 'mainline')
if ( !node ) {
return message.send_response(
message.fresh().error(Errors.NodeDoesNotExist)
)
}
node.guarantee_xattrs()
message.send_response(
message.fresh().data({ node: node.to_api(), names: node.extended_attributes.map(x => x.name) })
)
}