declapract
Version:
A tool to declaratively define best practices, maintainable evolve them, and scalably enforce them.
17 lines • 865 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.copyFileAsync = void 0;
const fs_1 = __importDefault(require("fs"));
const util_1 = __importDefault(require("util"));
const getDirOfPath_1 = require("../../utils/filepaths/getDirOfPath");
const makeDirAsync_1 = require("./makeDirAsync");
const copyFile = util_1.default.promisify(fs_1.default.copyFile);
const copyFileAsync = async ({ from, to, }) => {
await (0, makeDirAsync_1.makeDirectoryAsync)({ directoryPath: await (0, getDirOfPath_1.getDirOfPath)(to) }); // find or create the dir, before writing the file to the dir
await copyFile(from, to);
};
exports.copyFileAsync = copyFileAsync;
//# sourceMappingURL=copyFileAsync.js.map