cavity-cli

Crates.iocavity-cli
lib.rscavity-cli
version1.1.0
sourcesrc
created_at2017-11-24 23:22:17.454081
updated_at2017-11-24 23:22:17.454081
descriptionCreate files padded with zeros. Alternatinve to macOS's mkfile.
homepage
repositoryhttps://github.com/Inner-Heaven/cavity
max_upload_size
id40430
size8,296
Andrey Snow (andoriyu)

documentation

README

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();
Commit count: 11

cargo fmt