I maintain OdsIo.jl , a Julia package that wraps, for ods files specifically, ezodf , a Python package for various OpenDocument formats,
My "ods_readall" function starts by calling ezodf.opendoc
.
ezodf.opendoc
supports as input, other than the filename, the file byte content itself:
ezodf.opendoc(filename)¶
Parameters: filename (str) – a filename or the file-content as bytes
Is there a way I can use it with a Julia stream (eg a network gzipped file as in this question ) intead of plain files?
This seems to work, at least for HTTP, that is what I was interested to:
using HTTP, Pipe, PyCall
const pyio = PyNULL()
const ezodf = PyNULL()
copy!(pyio, pyimport("io"))
copy!(ezodf, pyimport("ezodf"))
function readstream(istream)
return ezodf.opendoc(pyio.BytesIO(istream))
end
urlData = "https://github.com/sylvaticus/OdsIO.jl/raw/master/test/spreadsheet.ods"
doc = @pipe HTTP.get(urlData).body |> readstream(_)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.