123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- 'use strict';
- const events = require('events');
- const is = require('./is');
- const sharp = require('../build/Release/sharp.node');
- const format = sharp.format();
- let versions = {
- vips: sharp.libvipsVersion()
- };
- try {
- versions = require('../vendor/versions.json');
- } catch (err) {}
- function cache (options) {
- if (is.bool(options)) {
- if (options) {
-
- return sharp.cache(50, 20, 100);
- } else {
- return sharp.cache(0, 0, 0);
- }
- } else if (is.object(options)) {
- return sharp.cache(options.memory, options.files, options.items);
- } else {
- return sharp.cache();
- }
- }
- cache(true);
- function concurrency (concurrency) {
- return sharp.concurrency(is.integer(concurrency) ? concurrency : null);
- }
- const queue = new events.EventEmitter();
- function counters () {
- return sharp.counters();
- }
- function simd (simd) {
- return sharp.simd(is.bool(simd) ? simd : null);
- }
- simd(true);
- module.exports = function (Sharp) {
- [
- cache,
- concurrency,
- counters,
- simd
- ].forEach(function (f) {
- Sharp[f.name] = f;
- });
- Sharp.format = format;
- Sharp.versions = versions;
- Sharp.queue = queue;
- };
|