Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convenience functions for dealing with .gz files #12

Merged
merged 5 commits into from
Jan 21, 2016

Conversation

samoconnor
Copy link
Contributor

Convenience functions to read/write directly from/to a named file.

I'm doing a cleanup of my local stash of convenience functions and thought that these might be generally useful.

gzwrite("/tmp/foo.gz", "hello")
gzreadall("/tmp/foo.gz")
"hello"

See also JuliaIO/GZip.jl#45 (comment)

Also, the example in README.md doesn't work...

stream = open("data.txt.gz", "w") |> ZlibDeflateOutputStream
for c in rand(UInt8, 10000)
    write(stream, c)
end
close(stream)

The underlying file needs to be closed to ensure that the file is completely written...

io = open("data.txt.gz", "w")
stream = ZlibDeflateOutputStream(io)
for c in rand(UInt8, 10000)
    write(stream, c)
end
close(stream)
close(io)

The gzopen(::Function...) methods in the PR make this easier by supporting gzopen("foo.gz") do io... syntax.

Convenience functions to read/write directly from/to a named file.

I'm doing a cleanup of my local stash of convenience functions and thought that these might be generally useful.

```julia
gzwrite("/tmp/foo.gz", "hello")
gzreadall("/tmp/foo.gz")
"hello"
```
@codecov-io
Copy link

Current coverage is 77.00%

Merging #12 into master will increase coverage by +3.41% as of c43f8db

@@            master    #12   diff @@
=====================================
  Files            5      5       
  Stmts          178    187     +9
  Branches         0      0       
  Methods          0      0       
=====================================
+ Hit            131    144    +13
  Partial          0      0       
+ Missed          47     43     -4

Review entire Coverage Diff as of c43f8db

Powered by Codecov. Updated on successful CI builds.

@tkelman
Copy link
Contributor

tkelman commented Jan 8, 2016

You can't export the same names from multiple packages.

@samoconnor
Copy link
Contributor Author

Hi @tkelman, re name clash across packages: @kmsquire suggested that Gzip.jl is depricated-ish in favour of Libz.jl, so I move the PR over to here.

More generally though, I imagine that its a useful pattern to have the same names from multiple packages if they really do the same thing. That would allow easy plug ability of alternate implementations.

@tkelman
Copy link
Contributor

tkelman commented Jan 8, 2016

Except that packages aren't always exactly drop in replacements (if they were they'd just be new versions instead of separate packages), and different downstream users have different requirements, including the ability to use both simultaneously.

@tkelman
Copy link
Contributor

tkelman commented Jan 8, 2016

If you want to extend the same generic function with new methods that makes complete sense, but you have to agree where the generic function is defined and extended from, and use completely disjoint type signatures for all methods.

@samoconnor
Copy link
Contributor Author

bump

JuliaLang/julia#14660 is now merged

This PR makes the gz interface more consistent with ::IO is base.

@TransGirlCodes
Copy link
Member

Awesome! Is there any chance of increasing the code coverage a bit before a merge? codecov is telling me it has fallen as a result of the PR.

@samoconnor
Copy link
Contributor Author

any chance of increasing the code coverage a bit before a merge?

done

@blahah
Copy link
Member

blahah commented Jan 21, 2016

@samoconnor that was fast!

if CI checks pass, LGTM :shipit:

@TransGirlCodes
Copy link
Member

Only appveyor fails, but it was failing before. I don't think it's a PR specific failing. :shipit:

TransGirlCodes pushed a commit that referenced this pull request Jan 21, 2016
Convenience functions for dealing with .gz files
@TransGirlCodes TransGirlCodes merged commit ba42de7 into BioJulia:master Jan 21, 2016
samoconnor added a commit to samoconnor/Libz.jl that referenced this pull request Jan 21, 2016
TransGirlCodes pushed a commit that referenced this pull request Mar 2, 2016
Update README.md with examples per #12
bicycle1885 added a commit that referenced this pull request Apr 14, 2016
bicycle1885 added a commit that referenced this pull request May 4, 2016
bicycle1885 added a commit that referenced this pull request May 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants