Shorten
This commit is contained in:
parent
18deac3a41
commit
025ef4e1d9
|
@ -141,26 +141,18 @@ const writeNodeStream = async (
|
||||||
|
|
||||||
// - Export
|
// - Export
|
||||||
|
|
||||||
export const exists = (path: string) => {
|
const exists = (path: string) => fs.existsSync(path);
|
||||||
return fs.existsSync(path);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const checkExistsAndCreateDir = async (dirPath: string) => {
|
const checkExistsAndCreateDir = async (dirPath: string) => {
|
||||||
if (!fs.existsSync(dirPath)) {
|
if (!fs.existsSync(dirPath)) {
|
||||||
await fs.mkdir(dirPath);
|
await fs.mkdir(dirPath);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const saveStreamToDisk = async (
|
const saveStreamToDisk = writeStream;
|
||||||
filePath: string,
|
|
||||||
fileStream: ReadableStream<Uint8Array>,
|
|
||||||
) => {
|
|
||||||
await writeStream(filePath, fileStream);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const saveFileToDisk = async (path: string, fileData: string) => {
|
const saveFileToDisk = (path: string, contents: string) =>
|
||||||
await fs.writeFile(path, fileData);
|
fs.writeFile(path, contents);
|
||||||
};
|
|
||||||
|
|
||||||
// -
|
// -
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue