Closed agarny closed 3 months ago
Indeed, initializeFromDirectory
is currently not implemented, and probably not needed. The underlying zip API uses overloads:
std::istream& buffer
and std::vector<unsigned char>& buffer
for support of memory streams. This could be easily used to make reading from archives possible.
That being said, I'm not sure that libCombine would properly work for WASM when creating combine archives, as it is relying on reading / writing temporary files (which would probably not work in WASM).
Argh, I clearly missed the GitHub notification since I have just seen your reply!
Indeed,
initializeFromDirectory
is currently not implemented, and probably not needed. The underlying zip API uses overloads:
std::istream& buffer
andstd::vector<unsigned char>& buffer
for support of memory streams. This could be easily used to make reading from archives possible.
That being said, I'm not sure that libCombine would properly work for WASM when creating combine archives, as it is relying on reading / writing temporary files (which would probably not work in WASM).
Yes, to read/write temporary files shouldn't be possible in WASM. Anyway, I will see what I can do about it since I would really like to take advantage of libCombine from WASM and thus have full support for CellML / SED-ML files and COMBINE archives from the web.
So, yes, I am going to look into it and create a PR if I can come up with something useful to the community.
Thank you so much, in the meantime .. do you want me to expose the ways mentioned above to initialize a CombineArchive instance from stream / vector?
Thank you so much, in the meantime .. do you want me to expose the ways mentioned above to initialize a CombineArchive instance from stream / vector?
Yes, it would be nice if you could, but no pressure (seriously).
Right now, we can initialise a COMBINE archive from a directory (using
initializeFromDirectory()
, although it doesn't seem to be doing anything?) or from an archive itself (usinginitializeFromArchive()
). However, if we look at libSBML and libSEDML, we can see that we can also "initialise" an SBML/SED-ML document from a string (usingreadSBMLFromString()
andreadSedMLFromString()
, respectively), which is very useful when wanting to "initialise" such a document on a website using WASM, for instance.So, in a similar way, it would be nice if we could initialise a COMBINE archive directly from the contents of a file (most likely using a
unsigned char *
parameter and asize_t
parameter sincestd::string
on its own wouldn't allow us to pass the contents of a COMBINE archive).