Skip to content

Commit

Permalink
Added support for .npy and .npz files. (#358)
Browse files Browse the repository at this point in the history
Co-authored-by: mkozieja <[email protected]>
  • Loading branch information
Pan-Maciek and mkozieja authored May 4, 2022
1 parent 21f435d commit d3d941e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/registry.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ format binary_little_endian 1.0 |
| HDF5 | .h5, .hdf5 | loads and saves on **all** platforms with [HDF5](http:///github.com/JuliaLang/HDF5.jl.git) | has detection function |
| STL_ASCII | .stl, .STL | loads and saves on **all** platforms with [MeshIO](http:///github.com/JuliaIO/MeshIO.jl.git) | has detection function |
| STL_BINARY | .stl, .STL | loads and saves on **all** platforms with [MeshIO](http:///github.com/JuliaIO/MeshIO.jl.git) | has detection function |
| NPY | .npy | loads and saves on **all** platforms with [NPZ](https://github.com/fhs/NPZ.jl) | "\x93NUMPY" |
| NPZ | .npz | loads and saves on **all** platforms with [NPZ](https://github.com/fhs/NPZ.jl) | "PK\x03\x04" |
3 changes: 3 additions & 0 deletions src/registry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const idVegaLite = :VegaLite => UUID("112f6efa-9a02-5b7d-90c0-432ed331239a")
const idVideoIO = :VideoIO => UUID("d6d074c3-1acf-5d4c-9a43-ef38773959a2")
const idLibSndFile = :LibSndFile => UUID("b13ce0c6-77b0-50c6-a2db-140568b8d1a5")
const idJpegTurbo = :JpegTurbo => UUID("b835a17e-a41a-41e7-81f0-2f016b05efe0")
const idNPZ = :NPZ => UUID("15e1cf62-19b3-5cfa-8e77-841668bca605")

### Simple cases

Expand All @@ -26,6 +27,8 @@ add_format(format"JLD2", (unsafe_wrap(Vector{UInt8},"Julia data file (HDF5), ver
add_format(format"GZIP", [0x1f, 0x8b], ".gz", [:Libz => UUID("2ec943e9-cfe8-584d-b93d-64dcb6d567b7")])
add_format(format"BSON",(),".bson", [:BSON => UUID("fbb218c0-5317-5bc6-957e-2ee96dd4b1f0")])
add_format(format"JLSO", (), ".jlso", [:JLSO => UUID("9da8a3cd-07a3-59c0-a743-3fdc52c30d11")])
add_format(format"NPY", "\x93NUMPY", ".npy", [idNPZ])
add_format(format"NPZ", "PK\x03\x04", ".npz", [idNPZ])

function detect_compressor(io, len=getlength(io); formats=["GZIP", "BZIP2", "XZ", "LZ4"])
seekstart(io)
Expand Down

0 comments on commit d3d941e

Please sign in to comment.