# git-spawned-stream

> Create a readable stream from a spawned git process.

Latest version **1.0.1** (published 2018-10-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install git-spawned-stream
pnpm add git-spawned-stream
yarn add git-spawned-stream
bun add git-spawned-stream
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-10-12 |
| First published | 2014-05-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 4.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Alexandru Vladutu |
| Maintainers | alessioalex |
| Keywords | spawned, git, stream |

## Links

- npm: https://www.npmjs.com/package/git-spawned-stream
- Repository: https://github.com/alessioalex/git-spawned-stream
- Issues: https://github.com/alessioalex/git-spawned-stream/issues
- npm.io page: https://npm.io/package/git-spawned-stream

## Dependencies (2)

- [debug](https://npm.io/package/debug.md) ^4.1.0
- [spawn-to-readstream](https://npm.io/package/spawn-to-readstream.md) ~0.1.3

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2018-10-12
- 1.0.0 — 2017-05-02
- 0.1.1 — 2015-10-30
- 0.1.0 — 2014-05-25

## README

# git-spawned-stream

Create a readable stream from a spawned git process.

## Usage

```js
gitSpawnedStream(repoPath, spawnArguments, limitInBytes, gitBinary)
```

Arguments:

- `repoPath` - the path to the repo, ex: /home/alex/node/.git (or the path to the git bare repo)
- `spawnArguments` - the arguments that will be passed to the `child_process.spawn` function
- `limitInBytes` - kill the process if it exceeds the imposed limit (sends more data than allowed)
- `gitBinary` - path to the git binary to use (use the one in `PATH` by default)

Example:

```js
var gitSpawnedStream = require('git-spawned-stream');
var path = require('path');
var repoPath = process.env.REPO || path.join(__dirname, '.git');
repoPath = path.resolve(repoPath);
var byteLimit = 5 * 1024 * 1024; // 5 Mb

// sort of a git log -n 2
var stream = gitSpawnedStream(repoPath, [
  'rev-list',
  '--max-count=2',
  '--header',
  'HEAD'
], byteLimit);

stream.on('data', function(data) {
  console.log('DATA', data.toString('utf8'));
}).on('error', function(err) {
  console.error('An error occurred:');
  console.error('-----------------\n');
  console.error(err.message);
  process.exit(1);
}).on('end', function(killed) {
  // when the stream is cut, killed === true
  console.log("\n±±±±±±±±±±±±±±±±±\nThat's all folks!");
});
```

## License

MIT

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