box-view-cli
Advanced tools
Comparing version 0.8.1 to 0.9.0
@@ -9,7 +9,6 @@ var fs = require('fs'), | ||
var extension = cmd.extension || ''; | ||
var outputFn; | ||
if (!cmd.output) { | ||
throw new Error('--output (-o) file required'); | ||
} | ||
if (cmd.documentId) { | ||
@@ -25,9 +24,15 @@ debug('content requested with document id "%s"', cmd.documentId); | ||
debug('got content (type %s)', extension); | ||
debug('writing to file %s', cmd.output); | ||
var file = fs.createWriteStream(cmd.output); | ||
file.on('finish', function() { | ||
debug('finished writing to file %s', cmd.output); | ||
file.close(); | ||
}); | ||
res.pipe(file); | ||
if (cmd.output) { | ||
debug('writing to file %s', cmd.output); | ||
var file = fs.createWriteStream(cmd.output); | ||
file.on('finish', function() { | ||
debug('finished writing to file %s', cmd.output); | ||
file.close(); | ||
}); | ||
res.pipe(file); | ||
} else { | ||
// just send it to stdout | ||
debug('no output file given... writing to stdout'); | ||
res.pipe(process.stdout); | ||
} | ||
} | ||
@@ -46,3 +51,3 @@ } | ||
['-e, --extension [extension]', 'the type of content to request (zip, pdf); if empty, get the original document type'], | ||
['-o, --output [file]', 'the name of the file to output data to'] | ||
['-o, --output [file]', 'the name of the file to output data to (otherwise stdout)'] | ||
], | ||
@@ -49,0 +54,0 @@ actions: [ |
@@ -9,3 +9,3 @@ var path = require('path'), | ||
if (err) { | ||
output.error(res); | ||
output.error(res.toString()); | ||
} else { | ||
@@ -12,0 +12,0 @@ output.log(res); |
{ | ||
"name": "box-view-cli", | ||
"version": "0.8.1", | ||
"version": "0.9.0", | ||
"description": "A CLI for Box View API", | ||
@@ -5,0 +5,0 @@ "author": "Cameron Lakenen <lakenen@box.com>", |
@@ -110,3 +110,3 @@ # Box View API CLI | ||
-e, --extension [extension] the type of content to request (zip, pdf); if empty, get the original document type | ||
-o, --output [file] the name of the file to output data to | ||
-o, --output [file] the name of the file to output data to (otherwise stdout) | ||
``` | ||
@@ -113,0 +113,0 @@ |
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
23704
487