Crates.io | drill-press |
lib.rs | drill-press |
version | 0.1.1 |
source | src |
created_at | 2022-02-16 16:00:17.72244 |
updated_at | 2022-09-16 10:33:03.907763 |
description | A cross platform library for listing and manipulating holes in sparse files. |
homepage | |
repository | https://github.com/aj-bagwell/drill-press |
max_upload_size | |
id | 533384 |
size | 48,432 |
A simple, cross platform crate for finding the locations of holes in sparse files.
Forked from Nathan McCarty's hole_punch (git)
Currently supports Unix-like platforms that support the SEEK_HOLE
and SEEK_DATA
commands on lseek
, as well as windows.
The operating systems that currently support filesystem-level sparsity information are:
These are currently implemented with a compile time switch, and SparseFile::scan_chunks
will always immediately return with a ScanError::UnsupportedPlatform
error on platforms not on this list.
use std::fs::File;
use hole_punch::*;
let mut file = File::open("a big sparse file");
let segments = file.scan_chunks().expect("Unable to scan chunks");
for segment in segments {
if SegmentType::Data == segment.segment_type {
let start = segment.start();
let length = segment.len();
do_something_with_data(&mut file, start, length);
}
}
Hole-Punch is distributed under your choice of the MIT license, or Apache 2.0.