Skip to content

Commit

Permalink
Replace ezgzip with bytesrw for Gzip (de)compression.
Browse files Browse the repository at this point in the history
  • Loading branch information
zoj613 committed Oct 3, 2024
1 parent 703afaa commit 5f9b91e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
(ocaml
(and (>= 4.14.0)))
(yojson (>= 1.6.0))
(ezgzip (>= 0.2.0))
(stdint (>= 0.7.2))
(checkseum (>= 0.4.0))
(odoc :with-doc)
Expand Down
1 change: 0 additions & 1 deletion zarr.opam
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ depends: [
"dune" {>= "3.15"}
"ocaml" {>= "4.14.0"}
"yojson" {>= "1.6.0"}
"ezgzip" {>= "0.2.0"}
"stdint" {>= "0.7.2"}
"checkseum" {>= "0.4.0"}
"odoc" {with-doc}
Expand Down
7 changes: 5 additions & 2 deletions zarr/src/codecs/bytes_to_bytes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ module GzipCodec = struct
Error (Printf.sprintf "Invalid Gzip level %d" i)

let encode l x =
Ezgzip.compress ~level:(to_int l) x
Bytes.Reader.to_string @@
Bytesrw_zlib.Gzip.compress_reads ~level:(to_int l) () @@
Bytes.Reader.of_string x

let decode x =
Result.get_ok @@ Ezgzip.decompress x
Bytes.Reader.to_string @@
Bytesrw_zlib.Gzip.decompress_reads () @@ Bytes.Reader.of_string x

let to_yojson l =
`Assoc
Expand Down
2 changes: 1 addition & 1 deletion zarr/src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
(public_name zarr)
(libraries
yojson
ezgzip
bytesrw.zstd
bytesrw.zlib
stdint
checkseum)
(ocamlopt_flags
Expand Down

0 comments on commit 5f9b91e

Please sign in to comment.