Skip to content

Commit e18bbdf

Browse files
committed
feat(utils): add optional parameter opts to writefile()
1 parent e62857a commit e18bbdf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lua/orgmode/utils/init.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,12 @@ end
5555

5656
---@param file string
5757
---@param data string|string[]
58+
---@param opts? {excl?: boolean}
5859
---@return OrgPromise<integer> bytes
59-
function utils.writefile(file, data)
60+
function utils.writefile(file, data, opts)
6061
return Promise.new(function(resolve, reject)
61-
uv.fs_open(file, 'w', 438, function(err1, fd)
62+
local flags = opts and opts.excl and 'wx' or 'w'
63+
uv.fs_open(file, flags, 438, function(err1, fd)
6264
if err1 then
6365
return reject(err1)
6466
end

0 commit comments

Comments
 (0)