image-dimensions-stream
Advanced tools
Comparing version 0.0.4 to 0.0.5
{ | ||
"name": "image-dimensions-stream", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Get image dimensions from stream", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -122,3 +122,10 @@ const { Transform } = require('stream'); | ||
if (state.options.maxMimeChunkOffset <= state.readBytes || state.options.maxMimeBufferSize <= state.bufferSize) { | ||
throw new Errors.MimeTypeNotFoundError(); | ||
if (state.options.requireMime({ | ||
mime: state.mime, | ||
readBytes: state.readBytes, | ||
})) { | ||
throw new Errors.MimeTypeNotFoundError(); | ||
} else { | ||
this._sizeState = null; | ||
} | ||
} | ||
@@ -183,5 +190,13 @@ | ||
} | ||
if (!state.dimensions && state.options.maxDimensionsBufferSize <= state.bufferSize) { | ||
throw new Errors.DimensionsNotFoundError(); | ||
if (state.requireDimensions({ | ||
dimensions: state.dimensions, | ||
mime: state.mime, | ||
readBytes: state.readBytes, | ||
})) { | ||
throw new Errors.DimensionsNotFoundError(); | ||
} else { | ||
this._sizeState = null; | ||
} | ||
} | ||
@@ -198,3 +213,3 @@ | ||
let err = null; | ||
if (state.options.requireMime({ | ||
@@ -201,0 +216,0 @@ mime: state.mime, |
18943
521