archive-type
Advanced tools
Comparing version 2.0.0 to 2.1.0
27
cli.js
#!/usr/bin/env node | ||
'use strict'; | ||
var archiveType = require('./'); | ||
var meow = require('meow'); | ||
var getStdin = require('get-stdin'); | ||
var readChunk = require('read-chunk'); | ||
var stdin = require('get-stdin'); | ||
var archiveType = require('./'); | ||
/** | ||
* Initialize CLI | ||
*/ | ||
var cli = meow({ | ||
@@ -25,6 +21,2 @@ help: [ | ||
/** | ||
* Run | ||
*/ | ||
function run(data) { | ||
@@ -41,6 +33,2 @@ var type = archiveType(new Buffer(data)); | ||
/** | ||
* Get stdin | ||
*/ | ||
if (process.stdin.isTTY) { | ||
@@ -59,12 +47,5 @@ if (!cli.input.length) { | ||
readChunk(cli.input[0], 0, 262, function (err, buf) { | ||
if (err) { | ||
console.error(err.message); | ||
process.exit(1); | ||
} | ||
run(buf); | ||
}); | ||
run(readChunk.sync(cli.input[0], 0, 262)); | ||
} else { | ||
stdin.buffer(run); | ||
getStdin.buffer(run); | ||
} |
@@ -5,9 +5,2 @@ 'use strict'; | ||
/** | ||
* Detect the archive type of a Buffer/Uint8Array | ||
* | ||
* @param {Buffer} buf | ||
* @api public | ||
*/ | ||
module.exports = function (buf) { | ||
@@ -14,0 +7,0 @@ var ret = fileType(buf); |
{ | ||
"name": "archive-type", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Detect the archive type of a Buffer/Uint8Array", | ||
@@ -42,4 +42,4 @@ "license": "MIT", | ||
"file-type": "^2.0.1", | ||
"get-stdin": "^3.0.0", | ||
"meow": "^2.0.0", | ||
"get-stdin": "^4.0.1", | ||
"meow": "^3.1.0", | ||
"read-chunk": "^1.0.0" | ||
@@ -46,0 +46,0 @@ }, |
4174
5
59
54
- Removedcamelcase@1.2.1(transitive)
- Removedcamelcase-keys@1.0.0(transitive)
- Removedget-stdin@3.0.2(transitive)
- Removedindent-string@1.2.2(transitive)
- Removedmeow@2.1.0(transitive)
- Removedobject-assign@2.1.1(transitive)
- Removedrepeating@1.1.3(transitive)
Updatedget-stdin@^4.0.1
Updatedmeow@^3.1.0