mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix type error
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
8409d56fdf
commit
06f4802748
@ -16,15 +16,17 @@ const writeFileInjectable = getInjectable({
|
|||||||
const { writeFile, ensureDir } = di.inject(fsInjectable);
|
const { writeFile, ensureDir } = di.inject(fsInjectable);
|
||||||
const getDirnameOfPath = di.inject(getDirnameOfPathInjectable);
|
const getDirnameOfPath = di.inject(getDirnameOfPathInjectable);
|
||||||
|
|
||||||
return async (filePath, content, opts) => {
|
return async (filePath, content, opts = {}) => {
|
||||||
await ensureDir(getDirnameOfPath(filePath), {
|
await ensureDir(getDirnameOfPath(filePath), {
|
||||||
mode: 0o755,
|
mode: 0o755,
|
||||||
...(opts ?? {}),
|
...opts,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { encoding = "utf-8", ...options } = opts;
|
||||||
|
|
||||||
await writeFile(filePath, content, {
|
await writeFile(filePath, content, {
|
||||||
encoding: "utf-8",
|
encoding: encoding as BufferEncoding,
|
||||||
...(opts ?? {}),
|
...options,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user