Closed turadg closed 11 years ago
Using the Treat.paths.file
setting allows you to change the download directory. Any reason why you specifically need to use Tempfile
?
Sorry, it should be Treat.paths.files
.
For one, I didn't know about Treat.paths.files
. ;)
But I I also need an in-memory copy of the file contents, so I figure it's best to read from the URL directly to memory, then write to disk so Treat can process it. When there is an in-memory copy of the file, why does Treat need it to be stored on disk as well?
The idea is to make the download large-file-proof by streaming chunks of the download to disk rather than reading the whole file into memory directly. Eventually, I would want to integrate a similar lazy iteration process within the entity classes as well.
For your use case, I would just do:
doc = Treat::Entities::Document.from_raw_file(file.path)
Calls to detect_format() passed a file, but the method expected a filename.
This patch changes the parameter to a file as expected.