Comparing version 1.0.1 to 1.0.2
16
main.js
@@ -12,4 +12,3 @@ 'use strict'; | ||
function isStream(stream) { | ||
return stream && typeof stream === 'object' && typeof stream.pipe === 'function' && stream.readable !== false | ||
&& typeof stream._read === 'function' && typeof stream._readableState === 'object'; | ||
return stream && typeof stream === 'object' && typeof stream.pipe === 'function' && stream.readable !== false && typeof stream._read === 'function' && typeof stream._readableState === 'object'; | ||
} | ||
@@ -45,11 +44,16 @@ | ||
function streamSync(stream, length) { | ||
var buf; | ||
if (!stream.closed && !stream.destroyed && length > 0) { | ||
/*var state = stream._readableState;*/ | ||
try { | ||
var buf = chunkSync(stream, length/* || state.highWaterMark*/); | ||
/*stream.emit('end');*/ | ||
var data = { | ||
path: stream.path, | ||
flags: stream.flags, | ||
mode: stream.mode, | ||
fd: stream.fd | ||
}; | ||
buf = chunkSync(data, length); | ||
return buf; | ||
} catch (e) { | ||
stream.emit('end'); | ||
throw new Error('The file must be local and exists.'); | ||
@@ -56,0 +60,0 @@ } |
{ | ||
"name": "mime-kind", | ||
"author": "Alexey Bystrov <strikeentco@gmail.com>", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Detect the mime type of a Buffer, ReadStream, file path and file name.", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
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
20023
152