Skip to content

API Reference

spawnPromise

Wraps spawn in a Promise to maintain async/await syntax.

### Parameters
| Name | Type | Description |
|------|------|-------------|
| `command` | `string` | The command to execute. |
| `args` | `Array.<string>` | The command arguments. |
| `logger` | `object` | The logger instance. |
| `captureOutput` | `boolean` | Whether to capture stdout for return value. |

### Returns
**Type:** `Promise.<object>`

- Resolves with result object when the process completes successfully.

parseVersionParts

Parses version string parts, extracting numeric prefixes from each segment.

Handles version suffixes like "1.18-rc1" by extracting just the numeric part.

### Parameters
| Name | Type | Description |
|------|------|-------------|
| `version` | `string` | The version string to parse. |

### Returns
**Type:** `Array.<number>`

- Array of numeric version parts.

compareVersions

Compares two versions (e.g., '1.10' vs '1.9').

Handles version suffixes like "1.18-rc1" by extracting numeric prefixes.

### Parameters
| Name | Type | Description |
|------|------|-------------|
| `version` | `string` | The current version. |
| `minVersion` | `string` | The minimum required version. |

### Returns
**Type:** `boolean`

- True if the current version is >= the minimum version, false if cannot compare.

checkToolAvailability

Checks if a tool is available and meets the minimum version.

### Parameters
| Name | Type | Description |
|------|------|-------------|
| `tool` | `string` | The name of the tool (samtools, tabix, or bgzip). |
| `versionCommand` | `string` | Command to check the tool version. |
| `minVersion` | `string` | The minimal required version. |
| `logger` | `object` | The logger instance. |

### Returns
**Type:** `Promise.<boolean>`

- Resolves to true if the tool is available and meets the version requirement.

Released under the GPL-3.0 License.