mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
1 parent
8409d56fdf
commit
06f4802748
1 file changed
+6
-4
@@ -16,15 +16,17 @@ const writeFileInjectable = getInjectable({
|
||||
const { writeFile, ensureDir } = di.inject(fsInjectable);
|
||||
const getDirnameOfPath = di.inject(getDirnameOfPathInjectable);
|
||||
|
||||
return async (filePath, content, opts) => {
|
||||
return async (filePath, content, opts = {}) => {
|
||||
await ensureDir(getDirnameOfPath(filePath), {
|
||||
mode: 0o755,
|
||||
...(opts ?? {}),
|
||||
...opts,
|
||||
});
|
||||
|
||||
const { encoding = "utf-8", ...options } = opts;
|
||||
|
||||
await writeFile(filePath, content, {
|
||||
encoding: "utf-8",
|
||||
...(opts ?? {}),
|
||||
encoding: encoding as BufferEncoding,
|
||||
...options,
|
||||
});
|
||||
};
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user