Crates.io | cavity-cli |
lib.rs | cavity-cli |
version | 1.1.0 |
source | src |
created_at | 2017-11-24 23:22:17.454081 |
updated_at | 2017-11-24 23:22:17.454081 |
description | Create files padded with zeros. Alternatinve to macOS's mkfile. |
homepage | |
repository | https://github.com/Inner-Heaven/cavity |
max_upload_size | |
id | 40430 |
size | 8,296 |
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 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
cavity
is available on crates.io and can be included in your Cargo enabled project like this:
[dependencies]
cavity = "1.1.0"
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();