Skip to content

Inner-Heaven/cavity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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();

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages