UNPKG

jok

Version:

Bundle of utility functions for code generation related to nodejs and graphql

19 lines (18 loc) 595 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var fs_1 = require("fs"); var mkdirp = require("mkdirp"); var path = require("path"); function default_1(location, output) { var fullpath = path.join(location); var folderPath = fullpath.substr(0, fullpath.lastIndexOf('/')); var dir = folderPath; if (!(0, fs_1.existsSync)(dir)) { mkdirp.sync(folderPath); } if ((0, fs_1.existsSync)(fullpath)) { (0, fs_1.unlinkSync)(fullpath); } (0, fs_1.writeFileSync)(fullpath, output, { flag: 'wx' }); } exports.default = default_1;