<commit_before># Range-Pool
Range-Pool is a base library for creating numeric range-based worker pools. It makes offset handling in distributed numeric operations easy.

For example, if you want to write a multi-connection download library that writes output from multiple requests to the same file, range-pool's index will make sure you get the correct position for each byte. Range-pool's API will also allow you to check which ranges are left so you can send http request with correct `Range` headers.

## Installation

```js
npm install --save range-pool
```

## API

```js
export class RangePool {
  constructor(length: number | Infinity)
  createWorker(): PoolWorker
  hasCompleted(): boolean
  hasWorkingWorker(): boolean
  getCompletedSteps(): boolean
  getRemaining(): number // out of length
  dispose()
}
class PoolWorker {
  advance(steps: number)
  isActive(): boolean
  getCompletionPercentage(): number
  getRemaining(): number
  getCurrentIndex(): number
  getStartIndex(): number
  getIndexLimit(): number
  hasCompleted(): boolean
  dispose()
}
```

## Example Usage

```js
'use babel'

import {RangePool} from 'range-pool'

const fileInfo: {
  size: number,
  url: string<commit_msg>:memo: Document the new API in README<commit_after># Range-Pool
Range-Pool is a base library for creating numeric range-based worker pools. It makes offset handling in distributed numeric operations easy.

For example, if you want to write a multi-connection download library that writes output from multiple requests to the same file, range-pool's index will make sure you get the correct position for each byte. Range-pool's API will also allow you to check which ranges are left so you can send http request with correct `Range` headers.

## Installation

```js
npm install --save range-pool
```

## API

```js
export class RangePool {
  constructor(length: number | Infinity)
  serialize(): Object
  createWorker(): PoolWorker
  hasCompleted(): boolean
  hasWorkingWorker(): boolean
  getCompletedSteps(): boolean
  getRemaining(): number // out of length
  dispose()
  static unserialize(info: Object): RangePool
}
class PoolWorker {
  advance(steps: number)
  isActive(): boolean
  getCompletionPercentage(): number
  getRemaining(): number
  getCurrentIndex(): number
  getStartIndex(): number
  getIndexLimit(): number
  hasCompleted(): boolean
  dispose()
}
```

## Example Usage

```js
'use babel'

import {RangePool} from 'range-pool'

const fileInfo: {
  size: number,
  url: string
{'fraction_non_alphanumeric': 0.09094551282051282, 'fraction_numerical': 0.0, 'mean_word_length': 4.662131519274377, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3966190', 'n_tokens_mistral': 688, 'n_tokens_neox': 662, 'n_words': 291}