#macos #cli #zero #padded #cavity #mkfile #alternatinve

app cavity-cli

Create files padded with zeros. Alternatinve to macOS's mkfile.

1 stable release

Uses old Rust 2015

1.1.0 Nov 24, 2017

#116 in #zero

BSD-2-Clause

11KB
157 lines

Crates.io

Cavity

Very small library to create files. It's an alternative to macOS's mkfile(8) that works on everything that has rust's std. Unlike mkfile(8) this uses configurable chunksize and has default of 512Kb.

CLI tool

Cli version of this called cavity-cli located in this repo. The tool is 2x times faster than mkfile(8). Don't think it's faster because its rust. Read this instead. Tool has some configuration option, but defaults are somewhat perfect. CLI tool has a lot of .unwrap() calls. Very unscientific benchmark:

 $ time target/release/cavity-cli  10G test.wat
target/release/cavity-cli 10G test.wat  0.00s user 9.92s system 49% cpu 20.110 total
 $ time mkfile 10G test2.wat
mkfile 10G test2.wat  1.83s user 31.84s system 87% cpu 38.339 total

asciicast

Installation

cavity is available on crates.io and can be included in your Cargo enabled project like this:

[dependencies]
cavity = "1.1.0"

Example

Read the "docs".

use cavity::{fill, Bytes, WriteMode};
use std::fs::File;
let mut f = File::create("wat.test").unwrap();
fill(Bytes::MegaBytes(5), None, WriteMode::FlushEvery, &mut f).unwrap();

Dependencies

~425KB