diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-10-21 08:42:41 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-10-21 08:42:41 +0200 |
commit | 77a89299f4764dc92b2e0fbedb1a6853256320ef (patch) | |
tree | 9dd9c06d8c2c833509e5f4038a27f58a825af81e /modules/luci-base/htdocs | |
parent | f7120fb43a0e7ac840a815d0409240d557c47732 (diff) |
luci.base: fs.js: expose mode param in fs.write()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/fs.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/fs.js b/modules/luci-base/htdocs/luci-static/resources/fs.js index 6eb0390909..8a96ea87e2 100644 --- a/modules/luci-base/htdocs/luci-static/resources/fs.js +++ b/modules/luci-base/htdocs/luci-static/resources/fs.js @@ -50,7 +50,7 @@ callFileRead = rpc.declare({ callFileWrite = rpc.declare({ object: 'file', method: 'write', - params: [ 'path', 'data' ] + params: [ 'path', 'data', 'mode' ] }); callFileRemove = rpc.declare({ @@ -177,13 +177,17 @@ var FileSystem = L.Class.extend(/** @lends LuCI.fs.prototype */ { * The file data to write. If it is null, it will be set to an empty * string. * + * @param {number} [mode] + * The permissions to use on file creation. Default is 420 (0644). + * * @returns {Promise<number>} * Returns a promise resolving to `0` or rejecting with an error stating * the failure reason. */ - write: function(path, data) { + write: function(path, data, mode) { data = (data != null) ? String(data) : ''; - return callFileWrite(path, data).then(handleRpcReply.bind(this, { '': 0 })); + mode = (mode != null) ? mode : 420; // 0644 + return callFileWrite(path, data, mode).then(handleRpcReply.bind(this, { '': 0 })); }, /** |