# glob-file-split

> An executable to split files across workers.

Latest version **0.0.6** (published 2021-09-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install glob-file-split
pnpm add glob-file-split
yarn add glob-file-split
bun add glob-file-split
```

Provides the command `glob-file-split`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2021-09-18 |
| First published | 2021-02-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 153.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Paul White |
| Maintainers | paulmwhite |
| Keywords | parallel, split, glob, files, tests, splitter, chunks, workers, cypress, jest |

## Links

- npm: https://www.npmjs.com/package/glob-file-split
- Repository: https://github.com/paulmwhite/glob-file-split-cli
- Issues: https://github.com/paulmwhite/glob-file-split-cli/issues
- npm.io page: https://npm.io/package/glob-file-split

## Dependencies (4)

- [glob](https://npm.io/package/glob.md) ^7.1.6
- [meow](https://npm.io/package/meow.md) ^9.0.0
- [chalk](https://npm.io/package/chalk.md) ^4.1.0
- [node-emoji](https://npm.io/package/node-emoji.md) ^1.10.0

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 0.0.6 (latest) — 2021-09-18
- 0.1.0 — 2021-02-20
- 0.0.5 — 2021-02-03
- 0.0.4 — 2021-02-03
- 0.0.3 — 2021-02-02
- 0.0.2 — 2021-02-02
- 0.0.1 — 2021-02-02

## README

# glob-file-split

This `glob-file-split` will split a glob pattern of files into a given number of chunks (splits) and return the files as a comma separated string for a given index.

This is ideal for splitting test files across multiple workers for parallel execution.

Examples:

```bash
    $ glob-file-split --splits 2 --index 0 --pattern './tests/*.js'
    ./tests/1.js,./tests/2.js,./tests/3.js

    $ glob-file-split -s 2 -i 1 -p './tests/*.js'
    ./tests/4.js,./tests/5.js
```

Example using to split test execution:

Worker 1:

```bash
    $ yarn test --spec $(glob-file-split -s 2 -i 0 -p './**/*.feature')
    cypress run --spec ./cypress/integration/1.feature,./cypress/integration/2.feature,./cypress/integration/3.feature
```

Worker 2:

```bash
    $ yarn test --spec $(glob-file-split -s 2 -i 1 -p './**/*.feature')
    cypress run --spec ./cypress/integration/4.feature,./cypress/integration/5.feature
```

## Parameters

| flag           | shorthand | accepts | example              |
| -------------- | --------- | ------- | -------------------- |
| --pattern      | -p        | string  | './tests/\*.feature' |
| --index        | -i        | number  | 0                    |
| --splits       | -s        | string  | 5                    |
| --deleteOthers | -d        | boolean | -d                   |

## Installation

Install globally:

```bash
  yarn global add glob-file-split
```

or

```bash
  npm i -g glob-file-split
```

---
_Source: https://npm.io/package/glob-file-split · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
