summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/htdocs
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-10-21 08:42:41 +0200
committerJo-Philipp Wich <jo@mein.io>2019-10-21 08:42:41 +0200
commit77a89299f4764dc92b2e0fbedb1a6853256320ef (patch)
tree9dd9c06d8c2c833509e5f4038a27f58a825af81e /modules/luci-base/htdocs
parentf7120fb43a0e7ac840a815d0409240d557c47732 (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.js10
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 }));
},
/**