mindee
Version:
Mindee Client Library for Node.js
21 lines (20 loc) • 606 B
JavaScript
import { LocalInputSource } from "./localInputSource.js";
import { INPUT_TYPE_BUFFER } from "./inputSource.js";
import { logger } from "../logger.js";
export class BufferInput extends LocalInputSource {
constructor({ buffer, filename }) {
super({
inputType: INPUT_TYPE_BUFFER,
});
this.fileObject = buffer;
this.filename = filename;
}
async init() {
if (this.initialized) {
return;
}
logger.debug("Loading from buffer");
this.mimeType = await this.checkMimetype();
this.initialized = true;
}
}