This commit is contained in:
Manav Rathi 2024-03-22 11:26:04 +05:30
parent 18deac3a41
commit 025ef4e1d9
No known key found for this signature in database

View file

@ -141,26 +141,18 @@ const writeNodeStream = async (
// - Export
export const exists = (path: string) => {
return fs.existsSync(path);
};
const exists = (path: string) => fs.existsSync(path);
export const checkExistsAndCreateDir = async (dirPath: string) => {
const checkExistsAndCreateDir = async (dirPath: string) => {
if (!fs.existsSync(dirPath)) {
await fs.mkdir(dirPath);
}
};
export const saveStreamToDisk = async (
filePath: string,
fileStream: ReadableStream<Uint8Array>,
) => {
await writeStream(filePath, fileStream);
};
const saveStreamToDisk = writeStream;
export const saveFileToDisk = async (path: string, fileData: string) => {
await fs.writeFile(path, fileData);
};
const saveFileToDisk = (path: string, contents: string) =>
fs.writeFile(path, contents);
// -