0.1.6 • Published 5 months ago

external-merge-sort v0.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

External Merge Sort

NPM Version

Implementation of external merge sort based on async generators. The sort function takes an iterable and returns an async generator yielding the input values sorted. It relies on a merge function which can also be useful on its own, in case you want to merge two or more iterables already sorted.

Usage

import { sort } from 'external-merge-sort'

const sorted = sort([3,1,2])

for await (const item of sorted) {
  console.log(item)
}

the simple usage above is not that useful in practice: the iterable input normally comes from a big file stream and you need to provide additional options to specify:

  • maxSize: the size of chunks in which to split the input
  • maxFiles: threshold to trigger an additional pass (usually not needed)
  • comparer: a custom comparison function
  • store: an object capable to write chunks to temporary storage, returning an iterable over stored items

See examples with text, json and rdf files.

0.1.6

5 months ago

0.1.5

6 months ago

0.1.4

11 months ago

0.1.3

1 year ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago