Skip to content

Commit 82ff251

Browse files
committed
Default to storing files uncompressed in .npz
1 parent 9e7f2c3 commit 82ff251

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

cnpy.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ namespace cnpy {
135135

136136
template <typename T>
137137
void npz_save(std::string zipname, std::string fname, const T *data,
138-
const std::vector<size_t> &shape, std::string mode = "w") {
138+
const std::vector<size_t> &shape, std::string mode = "w",
139+
int32_t comp = ZIP_CM_STORE) {
139140
libzip::flags_t flag = 0;
140141
if (mode == "a") {
141142
} else if (mode == "w") {
@@ -171,7 +172,8 @@ namespace cnpy {
171172
};
172173

173174
// Write everything
174-
zip.add(source, fname + ".npy");
175+
uint64_t index = zip.add(source, fname + ".npy");
176+
zip.set_file_compression(index, comp);
175177
}
176178

177179
template<typename T> void npy_save(std::string fname, const std::vector<T> data, std::string mode = "w") {

0 commit comments

Comments
 (0)