mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Move functions to improve logical ordering of docs
This commit is contained in:
@@ -1,8 +1,31 @@
|
||||
'use strict';
|
||||
|
||||
const events = require('events');
|
||||
const is = require('./is');
|
||||
const sharp = require('../build/Release/sharp.node');
|
||||
|
||||
/**
|
||||
* An Object containing nested boolean values representing the available input and output formats/methods.
|
||||
* @member
|
||||
* @example
|
||||
* console.log(sharp.format);
|
||||
* @returns {Object}
|
||||
*/
|
||||
const format = sharp.format();
|
||||
|
||||
/**
|
||||
* An Object containing the version numbers of libvips and its dependencies.
|
||||
* @member
|
||||
* @example
|
||||
* console.log(sharp.versions);
|
||||
*/
|
||||
let versions = {
|
||||
vips: sharp.libvipsVersion()
|
||||
};
|
||||
try {
|
||||
versions = require('../vendor/versions.json');
|
||||
} catch (err) {}
|
||||
|
||||
/**
|
||||
* Gets or, when options are provided, sets the limits of _libvips'_ operation cache.
|
||||
* Existing entries in the cache will be trimmed after any change in limits.
|
||||
@@ -61,6 +84,18 @@ function concurrency (concurrency) {
|
||||
return sharp.concurrency(is.integer(concurrency) ? concurrency : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* An EventEmitter that emits a `change` event when a task is either:
|
||||
* - queued, waiting for _libuv_ to provide a worker thread
|
||||
* - complete
|
||||
* @member
|
||||
* @example
|
||||
* sharp.queue.on('change', function(queueLength) {
|
||||
* console.log('Queue contains ' + queueLength + ' task(s)');
|
||||
* });
|
||||
*/
|
||||
const queue = new events.EventEmitter();
|
||||
|
||||
/**
|
||||
* Provides access to internal task counters.
|
||||
* - queue is the number of tasks this module has queued waiting for _libuv_ to provide a worker thread from its pool.
|
||||
@@ -110,4 +145,7 @@ module.exports = function (Sharp) {
|
||||
].forEach(function (f) {
|
||||
Sharp[f.name] = f;
|
||||
});
|
||||
Sharp.format = format;
|
||||
Sharp.versions = versions;
|
||||
Sharp.queue = queue;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user