mindee
Version:
Mindee Client Library for Node.js
29 lines (28 loc) • 964 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Base64Input = void 0;
const localInputSource_1 = require("./localInputSource");
const inputSource_1 = require("./inputSource");
const logger_1 = require("../../logger");
class Base64Input extends localInputSource_1.LocalInputSource {
constructor({ inputString, filename }) {
super({
inputType: inputSource_1.INPUT_TYPE_BASE64,
});
this.fileObject = Buffer.alloc(0);
this.filename = filename;
this.inputString = inputString;
}
async init() {
if (this.initialized) {
return;
}
logger_1.logger.debug("Loading from base64");
this.fileObject = Buffer.from(this.inputString, "base64");
this.mimeType = await this.checkMimetype();
// clear out the string
this.inputString = "";
this.initialized = true;
}
}
exports.Base64Input = Base64Input;