mirror of
https://github.com/ful1e5/Bibata_Cursor.git
synced 2025-06-05 17:14:34 -04:00
💾 Write Schema data async util
This commit is contained in:
parent
32d03e86bf
commit
3f573c17c6
1 changed files with 14 additions and 0 deletions
14
packages/round/src/utils/writeSchema.ts
Normal file
14
packages/round/src/utils/writeSchema.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { exists, mkdir, writeFile } from "fs";
|
||||
|
||||
const writeSchemaData = (location: string, content: string) => {
|
||||
exists(location, (exists) => {
|
||||
if (!exists) {
|
||||
mkdir(location, { recursive: true }, () => {});
|
||||
}
|
||||
});
|
||||
writeFile(location, content, "utf-8", () => {
|
||||
throw new Error(`Oops Something went wrong with Schema Generator`);
|
||||
});
|
||||
};
|
||||
|
||||
export { writeSchemaData };
|
Loading…
Add table
Add a link
Reference in a new issue