mirror of
https://github.com/Shiva108/ai-llm-red-team-handbook.git
synced 2026-08-28 13:50:53 +02:00
19 lines
727 B
JavaScript
19 lines
727 B
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
const parser_1 = __importDefault(require("./parser"));
|
|
const fs_1 = __importDefault(require("fs"));
|
|
function DataURISync(fileName) {
|
|
if (!fileName || !fileName.trim || fileName.trim() === '') {
|
|
throw new Error('Insert a File path as string argument');
|
|
}
|
|
const parser = new parser_1.default();
|
|
if (fs_1.default.existsSync(fileName)) {
|
|
const fileContent = fs_1.default.readFileSync(fileName);
|
|
return parser.format(fileName, fileContent);
|
|
}
|
|
throw new Error(`The file ${fileName} was not found!`);
|
|
}
|
|
module.exports = DataURISync;
|