batch
Split an array into chunks of a specified size.
Parameters
- source_keystringrequired
- Context key holding the source array
- output_keystringrequired
- Context key where the array of batches will be stored
- sizeintegerrequired
- Number of items per batch. Must be greater than 0.
Context Output
{output_key}— an array of arrays, where each inner array contains up tosizeitems. The last batch may contain fewer items.{output_key}_count— number of batches produced
Example
flow:step("chunk", nodes.batch({
source_key = "all_records",
size = 50,
output_key = "batches"
})):depends_on("fetch_records")