diff --git a/src/npz.rs b/src/npz.rs index 29eded8..ba488db 100644 --- a/src/npz.rs +++ b/src/npz.rs @@ -103,6 +103,18 @@ impl 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, + } + } + /// Adds an array with the specified `name` to the `.npz` file. /// /// Note that a `.npy` extension will be appended to `name`; this matches NumPy's behavior.