Skip to main content

split_file

Function split_file 

Source
pub fn split_file<P: AsRef<Path>>(
    path: P,
    parts: usize,
) -> Result<Vec<Range<u64>>>
Expand description

Split an uncompressed FASTA/FASTQ file into parts byte ranges that each start exactly on a record boundary.

The returned ranges cover the whole file, are non-overlapping and in order. Fewer ranges than requested may come back when the file is small or its records are large.

let ranges = fastx::parallel::split_file("reads.fq", 8)?;
assert!(ranges.windows(2).all(|w| w[0].end == w[1].start));