git-spawned-stream
Advanced tools
Comparing version 0.1.1 to 1.0.0
@@ -5,3 +5,3 @@ "use strict"; | ||
var path = require('path'); | ||
var repoPath = process.env.REPO || (__dirname + '.git'); | ||
var repoPath = process.env.REPO || path.join(__dirname, '.git'); | ||
repoPath = path.resolve(repoPath); | ||
@@ -21,3 +21,3 @@ var byteLimit = 5 * 1024 * 1024; // 5 Mb | ||
}).on('error', function(err) { | ||
console.error('An error occured:'); | ||
console.error('An error occurred:'); | ||
console.error('-----------------\n'); | ||
@@ -24,0 +24,0 @@ console.error(err.message); |
12
index.js
@@ -7,5 +7,12 @@ "use strict"; | ||
module.exports = function(repoPath, args, limit) { | ||
module.exports = function(repoPath, args, limit, gitCommand = 'git') { | ||
var _args = ['--git-dir=' + repoPath]; | ||
// The limit is a git bin path | ||
if (typeof limit === 'string') { | ||
debug('got string limit, using it as gitCommand and unsetting limit'); | ||
gitCommand = limit; | ||
limit = undefined; | ||
} | ||
args.forEach(function(item) { | ||
@@ -17,4 +24,5 @@ _args.push(item); | ||
debug('limit', limit); | ||
debug('gitCommand', gitCommand); | ||
return run(spawn('git', _args), limit); | ||
return run(spawn(gitCommand, _args), limit); | ||
}; |
{ | ||
"name": "git-spawned-stream", | ||
"version": "0.1.1", | ||
"version": "1.0.0", | ||
"description": "Create a readable stream from a spawned git process.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,3 +8,3 @@ # git-spawned-stream | ||
```js | ||
gitSpawnedStream(repoPath, spawnArguments, limitInBytes) | ||
gitSpawnedStream(repoPath, spawnArguments, limitInBytes, gitBinary) | ||
``` | ||
@@ -17,2 +17,3 @@ | ||
- `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) | ||
@@ -24,3 +25,3 @@ Example: | ||
var path = require('path'); | ||
var repoPath = process.env.REPO || (__dirname + '.git'); | ||
var repoPath = process.env.REPO || path.join(__dirname, '.git'); | ||
repoPath = path.resolve(repoPath); | ||
@@ -40,3 +41,3 @@ var byteLimit = 5 * 1024 * 1024; // 5 Mb | ||
}).on('error', function(err) { | ||
console.error('An error occured:'); | ||
console.error('An error occurred:'); | ||
console.error('-----------------\n'); | ||
@@ -43,0 +44,0 @@ console.error(err.message); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
4376
68
0
51