-
Notifications
You must be signed in to change notification settings - Fork 0
MemoryWrapper
Eugene Lazutkin edited this page Jun 25, 2026
·
1 revision
An in-memory ObjectStreamWrapper backed by a plain array. For tests, small data, and benchmarking the sort algorithms independently of disk.
import {MemoryWrapper} from 'stream-sorting';
import sort from 'stream-sorting/sort.js';
const sorted = sort(input, {
compare: (a, b) => a - b,
batchSize: 1000,
createWrapper: () => new MemoryWrapper()
});new MemoryWrapper() takes no arguments. Each instance holds one run's worth of items, so pass a fresh one per run via createWrapper (for sort) or as the entries of files (for polyphaseSort).
See also: ObjectStreamWrapper, LocalFileWrapper.