Global

Methods

chunkBetween(input, fn, chunkSizeopt)

Chunks a multiline string or Buffer and maps fn to wrap each chunk

chunkBetween('a\nb\nc', (chunk) => `INSERT { ${chunk} }`, 2)
// INSERT { a\nb }
// INSERT { c }
Parameters:
Name Type Attributes Default Description
input string | Buffer
fn function

Function mapped to each chunk

chunkSize number <optional>
5_000

Size of each chunk

Source:
Returns:

string[]