💾 Write Schema data async util

This commit is contained in:
ful1e5 2020-08-31 17:27:34 +05:30
parent 32d03e86bf
commit 3f573c17c6

View 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 };