Comparing version 0.30.3 to 0.30.4
@@ -108,3 +108,3 @@ 'use strict'; | ||
* @param {boolean} [images[].animated=false] - Set to `true` to read all frames/pages of an animated image. | ||
* @param {boolean} [images[].failOnError=true] - @see {@link /api-constructor#parameters|constructor parameters} | ||
* @param {string} [images[].failOn='warning'] - @see {@link /api-constructor#parameters|constructor parameters} | ||
* @param {number|boolean} [images[].limitInputPixels=268402689] - @see {@link /api-constructor#parameters|constructor parameters} | ||
@@ -111,0 +111,0 @@ * @returns {Sharp} |
@@ -101,4 +101,3 @@ 'use strict'; | ||
* @param {Object} [options] - if present, is an Object with optional attributes. | ||
* @param {boolean} [options.failOnError=true] - by default halt processing and raise an error when loading invalid images. | ||
* Set this flag to `false` if you'd rather apply a "best effort" to decode images, even if the data is corrupt or invalid. | ||
* @param {string} [options.failOn='warning'] - level of sensitivity to invalid images, one of (in order of sensitivity): 'none' (least), 'truncated', 'error' or 'warning' (most), highers level imply lower levels. | ||
* @param {number|boolean} [options.limitInputPixels=268402689] - Do not process input images where the number of pixels | ||
@@ -324,5 +323,3 @@ * (width x height) exceeds this limit. Assumes image dimensions contained in the input metadata can be trusted. | ||
* const got = require("got"); | ||
* const sharpStream = sharp({ | ||
* failOnError: false | ||
* }); | ||
* const sharpStream = sharp({ failOn: 'none' }); | ||
* | ||
@@ -329,0 +326,0 @@ * const promises = []; |
@@ -12,5 +12,5 @@ 'use strict'; | ||
function _inputOptionsFromObject (obj) { | ||
const { raw, density, limitInputPixels, unlimited, sequentialRead, failOnError, animated, page, pages, subifd } = obj; | ||
return [raw, density, limitInputPixels, unlimited, sequentialRead, failOnError, animated, page, pages, subifd].some(is.defined) | ||
? { raw, density, limitInputPixels, unlimited, sequentialRead, failOnError, animated, page, pages, subifd } | ||
const { raw, density, limitInputPixels, unlimited, sequentialRead, failOn, failOnError, animated, page, pages, subifd } = obj; | ||
return [raw, density, limitInputPixels, unlimited, sequentialRead, failOn, failOnError, animated, page, pages, subifd].some(is.defined) | ||
? { raw, density, limitInputPixels, unlimited, sequentialRead, failOn, failOnError, animated, page, pages, subifd } | ||
: undefined; | ||
@@ -25,3 +25,3 @@ } | ||
const inputDescriptor = { | ||
failOnError: true, | ||
failOn: 'warning', | ||
limitInputPixels: Math.pow(0x3FFF, 2), | ||
@@ -44,3 +44,3 @@ unlimited: false, | ||
} | ||
inputDescriptor.buffer = Buffer.from(input.buffer); | ||
inputDescriptor.buffer = Buffer.from(input.buffer, input.byteOffset, input.byteLength); | ||
} else if (is.plainObject(input) && !is.defined(inputOptions)) { | ||
@@ -62,6 +62,6 @@ // Plain Object descriptor, e.g. create | ||
if (is.object(inputOptions)) { | ||
// Fail on error | ||
// Deprecated: failOnError | ||
if (is.defined(inputOptions.failOnError)) { | ||
if (is.bool(inputOptions.failOnError)) { | ||
inputDescriptor.failOnError = inputOptions.failOnError; | ||
inputDescriptor.failOn = inputOptions.failOnError ? 'warning' : 'none'; | ||
} else { | ||
@@ -71,2 +71,10 @@ throw is.invalidParameterError('failOnError', 'boolean', inputOptions.failOnError); | ||
} | ||
// failOn | ||
if (is.defined(inputOptions.failOn)) { | ||
if (is.string(inputOptions.failOn) && is.inArray(inputOptions.failOn, ['none', 'truncated', 'error', 'warning'])) { | ||
inputDescriptor.failOn = inputOptions.failOn; | ||
} else { | ||
throw is.invalidParameterError('failOn', 'one of: none, truncated, error, warning', inputOptions.failOn); | ||
} | ||
} | ||
// Density | ||
@@ -73,0 +81,0 @@ if (is.defined(inputOptions.density)) { |
@@ -423,2 +423,13 @@ 'use strict'; | ||
* Produce the "negative" of the image. | ||
* | ||
* @example | ||
* const output = await sharp(input) | ||
* .negate() | ||
* .toBuffer(); | ||
* | ||
* @example | ||
* const output = await sharp(input) | ||
* .negate({ alpha: false }) | ||
* .toBuffer(); | ||
* | ||
* @param {Object} [options] | ||
@@ -425,0 +436,0 @@ * @param {Boolean} [options.alpha=true] Whether or not to negate any alpha channel |
@@ -154,2 +154,4 @@ 'use strict'; | ||
* | ||
* EXIF metadata is unsupported for TIFF output. | ||
* | ||
* @example | ||
@@ -156,0 +158,0 @@ * sharp('input.jpg') |
{ | ||
"name": "sharp", | ||
"description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images", | ||
"version": "0.30.3", | ||
"version": "0.30.4", | ||
"author": "Lovell Fuller <npm@lovell.info>", | ||
@@ -84,3 +84,4 @@ "homepage": "https://github.com/lovell/sharp", | ||
"Chris Banks <christopher.bradley.banks@gmail.com>", | ||
"Ompal Singh <ompal.hitm09@gmail.com>" | ||
"Ompal Singh <ompal.hitm09@gmail.com>", | ||
"Brodan <christopher.hranj@gmail.com" | ||
], | ||
@@ -130,7 +131,7 @@ "scripts": { | ||
"dependencies": { | ||
"color": "^4.2.1", | ||
"color": "^4.2.3", | ||
"detect-libc": "^2.0.1", | ||
"node-addon-api": "^4.3.0", | ||
"prebuild-install": "^7.0.1", | ||
"semver": "^7.3.5", | ||
"semver": "^7.3.7", | ||
"simple-get": "^4.0.1", | ||
@@ -137,0 +138,0 @@ "tar-fs": "^2.1.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
491428
4594
Updatedcolor@^4.2.3
Updatedsemver@^7.3.7