pub fn stream_delimited(
reader: impl Read,
from_delim: u8,
writer: impl Write,
to_delim: u8,
transforms: &Transforms,
) -> Result<(), Box<dyn Error>>Expand description
Converts CSV or TSV input to CSV or TSV output using constant memory.
Reads row by row and writes row by row, so peak memory is bounded by the largest single row, not by file size. Applies filter, select, rename, and limit transforms on the fly. Sorting and other buffering transforms are not supported here.
§Errors
Returns an error if the input is malformed, if a transform fails, or if the output writer fails.
§Examples
use sheeter_engine::{stream_delimited, Transforms};
let input = b"a\n1\n2\n3\n";
let mut output = Vec::new();
stream_delimited(input.as_slice(), b',', &mut output, b',', &Transforms::default()).unwrap();
assert_eq!(output, b"a\n1\n2\n3\n");