New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

git-spawned-stream

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-spawned-stream

Create a readable stream from a spawned git process.

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

git-spawned-stream

Create a readable stream from a spawned git process.

Usage

gitSpawnedStream(repoPath, spawnArguments, limitInBytes)

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)

Example:

var gitSpawnedStream = require('git-spawned-stream');
var path = require('path');
var repoPath = process.env.REPO || (__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 occured:');
  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

Keywords

FAQs

Package last updated on 30 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc