mirror of
https://github.com/lovell/sharp.git
synced 2025-12-18 23:05:04 +01:00
Docs: add timeout example
This commit is contained in:
@@ -1050,6 +1050,17 @@ function tile (options) {
|
||||
* The clock starts when libvips opens an input image for processing.
|
||||
* Time spent waiting for a libuv thread to become available is not included.
|
||||
*
|
||||
* @example
|
||||
* // Ensure processing takes no longer than 3 seconds
|
||||
* try {
|
||||
* const data = await sharp(input)
|
||||
* .blur(1000)
|
||||
* .timeout({ seconds: 3 })
|
||||
* .toBuffer();
|
||||
* } catch (err) {
|
||||
* if (err.message.includes('timeout')) { ... }
|
||||
* }
|
||||
*
|
||||
* @since 0.29.2
|
||||
*
|
||||
* @param {Object} options
|
||||
|
||||
Reference in New Issue
Block a user