1 parent ee514e4 commit 9920008Copy full SHA for 9920008
1 file changed
cnpy.h
@@ -135,7 +135,8 @@ namespace cnpy {
135
136
template <typename T>
137
void npz_save(std::string zipname, std::string fname, const T *data,
138
- const std::vector<size_t> &shape, std::string mode = "w") {
+ const std::vector<size_t> &shape, std::string mode = "w",
139
+ int32_t comp = ZIP_CM_STORE) {
140
libzip::flags_t flag = 0;
141
if (mode == "a") {
142
} else if (mode == "w") {
@@ -171,7 +172,8 @@ namespace cnpy {
171
172
};
173
174
// Write everything
- zip.add(source, fname + ".npy");
175
+ uint64_t index = zip.add(source, fname + ".npy");
176
+ zip.set_file_compression(index, comp);
177
}
178
179
template<typename T> void npy_save(std::string fname, const std::vector<T> data, std::string mode = "w") {
0 commit comments