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

compress bson file with CodecZstd.jl ? #81

Open
norci opened this issue Feb 13, 2021 · 1 comment
Open

compress bson file with CodecZstd.jl ? #81

norci opened this issue Feb 13, 2021 · 1 comment

Comments

@norci
Copy link

norci commented Feb 13, 2021

Can I save a compressed BSON file?
such as using CodecZstd.jl ?

e.g. Pandas has a parameter compression='infer'
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html

@norci
Copy link
Author

norci commented Feb 13, 2021

I have figured out:

julia> open("/tmp/a.bson.zstd", "w") do fd
           stream = ZstdCompressorStream(fd)
           BSON.@save(stream, x = "abcd"^4096)
           close(stream)
       end

julia> open("/tmp/a.bson.zstd", "r") do fd
           stream = ZstdDecompressorStream(fd)
           display(BSON.load(stream))
           close(stream)
       end
Dict{Symbol, Any} with 1 entry:
  :x => "abcdabcd…

shell> ls -lah /tmp/a.bson.zstd
-rw-r--r-- 1 coder coder 34 Feb 13 15:47 /tmp/a.bson.zstd

Shall we add this to the document?

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

No branches or pull requests

1 participant