Class: Mindee::Input::Source::BytesInputSource

Inherits:
LocalInputSource show all
Defined in:
lib/mindee/input/sources.rb

Overview

Load a document from raw bytes.

Instance Attribute Summary

Attributes inherited from LocalInputSource

#file_mimetype, #filename, #io_stream

Instance Method Summary collapse

Methods inherited from LocalInputSource

#compress!, #count_pdf_pages, #pdf?, #process_pdf, #read_document, #rescue_broken_pdf, #source_text?

Constructor Details

#initialize(raw_bytes, filename, fix_pdf: false) ⇒ BytesInputSource

Returns a new instance of BytesInputSource.

Parameters:

  • raw_bytes (String)
  • filename (String)
  • fix_pdf (Boolean) (defaults to: false)


204
205
206
207
208
# File 'lib/mindee/input/sources.rb', line 204

def initialize(raw_bytes, filename, fix_pdf: false)
  io_stream = StringIO.new(raw_bytes)
  io_stream.set_encoding Encoding::BINARY
  super(io_stream, filename, fix_pdf: fix_pdf)
end