Sync API with Ruby’s Zlib::GzipFile
Closed this issue · 2 comments
Quintus commented
There are some subtle differences between ruby-xz’s API and Ruby’s own Zlib wrapper, which should be removed so that a uniform interface exists. These differences are:
- StreamReader#close and StreamWriter#close do not close the underlying IO automatically, Zlib does.
- StreamReader::new and StreamReader::open behave slightly different with respect to their arguments. The former should not accept filenames, the latter should not accept IO objects.
- Likewise for StreamWriter.
These are breaking API changes and require a major release. Given the low amount of reported bugs, doing a 1.0.0 release should be doable anyway.
Quintus commented
For this, it is also necessary to add the #finish method in a similar mannor as Ruby’s GzipFile#finish.
Quintus commented
It appears Zlib::GzipReader.new does not accept a block, and neither does Zlib::GZipWriter.new. There’s Zlib::GZipFile.wrap instead, and the ::open methods, which do accept a block. Hmmmm.