Shorten
This commit is contained in:
parent
18deac3a41
commit
025ef4e1d9
1 changed files with 5 additions and 13 deletions
|
@ -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);
|
||||
|
||||
// -
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue