From d1e9d38f53dec32e6282add0b879ad2ed884ba01 Mon Sep 17 00:00:00 2001 From: garrettmills Date: Fri, 27 Nov 2020 13:45:00 -0600 Subject: [PATCH] Add support for chmod --- index.js | 1 + ops/chmod.js | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 ops/chmod.js diff --git a/index.js b/index.js index 6407749..2662046 100644 --- a/index.js +++ b/index.js @@ -25,6 +25,7 @@ const ops = { fgetattr: require('./ops/fgetattr'), symlink: require('./ops/symlink'), readlink: require('./ops/readlink'), + chmod: require('./ops/chmod'), } ;(async () => { diff --git a/ops/chmod.js b/ops/chmod.js new file mode 100644 index 0000000..f4264d8 --- /dev/null +++ b/ops/chmod.js @@ -0,0 +1,18 @@ +const Fuse = require('fuse-native') +const Errors = require('../../shared/Errors') +const Message = require('../../shared/Message') +const connector = require('../connector') + +module.exports = exports = function (path, mode, cb) { + connector.send( + Message.route('fs.chmod') + .data({ path, mode }) + .expect_response(msg => { + if ( msg.error() ) { + return Errors.toCallback(cb, msg.error()) + } + + return process.nextTick(cb, 0) + }) + ) +}