reg-suit-core
Version:
See https://github.com/Quramy/reg-suit .
23 lines • 978 B
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.copyImagesSync = void 0;
const path_1 = __importDefault(require("path"));
const fs_1 = require("fs");
const copiedExtensions = [".png", ".jpg", ".jpeg", ".tiff", ".bmp", ".gif"];
function copyImagesSync(from, to) {
const stats = (0, fs_1.statSync)(from);
if (stats.isDirectory()) {
for (const inner of (0, fs_1.readdirSync)(from)) {
copyImagesSync(path_1.default.join(from, inner), path_1.default.join(to, inner));
}
}
else if (stats.isFile() && copiedExtensions.some(ext => from.endsWith(ext))) {
(0, fs_1.mkdirSync)(path_1.default.dirname(to), { recursive: true });
(0, fs_1.copyFileSync)(from, to);
}
}
exports.copyImagesSync = copyImagesSync;
//# sourceMappingURL=copy-image-sync.js.map
;