declapract
Version:
A tool to declaratively define best practices, maintainable evolve them, and scalably enforce them.
26 lines • 1.58 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
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("../filepaths/getDirOfPath");
const makeDirAsync_1 = require("./makeDirAsync");
const copyFile = util_1.default.promisify(fs_1.default.copyFile);
const copyFileAsync = (_a) => __awaiter(void 0, [_a], void 0, function* ({ from, to, }) {
yield (0, makeDirAsync_1.makeDirectoryAsync)({ directoryPath: yield (0, getDirOfPath_1.getDirOfPath)(to) }); // find or create the dir, before writing the file to the dir
yield copyFile(from, to);
});
exports.copyFileAsync = copyFileAsync;
//# sourceMappingURL=copyFileAsync.js.map