Function autocompress::create_or_stdout[][src]

pub fn create_or_stdout(
    path: Option<impl AsRef<Path>>,
    level: CompressionLevel
) -> Result<Box<dyn Write + Send>>
Expand description

Create new writer from a file path. If a file path is None, standard output is used. File format is suggested from file extension.

let mut writer = create_or_stdout(Some("create.txt.lz4"), CompressionLevel::Default)?;
writer.write_all(b"hello, world")?;