diff --git a/Cargo.toml b/Cargo.toml index a486381..d3a8ca2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,6 @@ zip = { version = "0.6.3", default-features = false, optional = true } default = ["compressed_npz", "num-complex-0_4"] npz = ["zip"] compressed_npz = ["npz", "zip/deflate"] -compressed_npz_zstd = ["npz", "zip/zstd"] [dev-dependencies] memmap2 = "0.2" diff --git a/src/npz.rs b/src/npz.rs index 2cafd3b..ba488db 100644 --- a/src/npz.rs +++ b/src/npz.rs @@ -103,16 +103,15 @@ impl NpzWriter { } } - // TODO: it makes sense to add support for bzip2 also - // this necessitates some more generic API, as having three functions is janky... =) - - /// Creates a new `.npz` file with zstd compression. While it is not directly supported by numpy, - /// it still could be useful (also it is possible to monkey-patch numpy to support it). - #[cfg(feature = "compressed_npz_zstd")] - pub fn new_zstd_compressed(writer: W, level: Option) -> NpzWriter { + /// Creates a new `.npz` file with the specified options. + /// + /// This allows you to use a custom compression method, such as [`CompressionMethod::Zstd`] or set other options. + /// + /// Make sure to enable the `zstd` feature of the `zip` crate to use [`CompressionMethod::Zstd`] or other relevant features. + pub fn new_with_options(writer: W, options: FileOptions) -> NpzWriter { NpzWriter { zip: ZipWriter::new(writer), - options: FileOptions::default().compression_method(CompressionMethod::ZSTD).compression_level(level), + options, } }