mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Expose platform-arch of vendored binaries #2928
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const events = require('events');
|
||||
const detectLibc = require('detect-libc');
|
||||
|
||||
@@ -47,7 +49,22 @@ let versions = {
|
||||
};
|
||||
try {
|
||||
versions = require(`../vendor/${versions.vips}/${platformAndArch}/versions.json`);
|
||||
} catch (err) {}
|
||||
} catch (_err) { /* ignore */ }
|
||||
|
||||
/**
|
||||
* An Object containing the platform and architecture
|
||||
* of the current and installed vendored binaries.
|
||||
* @member
|
||||
* @example
|
||||
* console.log(sharp.vendor);
|
||||
*/
|
||||
const vendor = {
|
||||
current: platformAndArch,
|
||||
installed: []
|
||||
};
|
||||
try {
|
||||
vendor.installed = fs.readdirSync(path.join(__dirname, `../vendor/${versions.vips}`));
|
||||
} catch (_err) { /* ignore */ }
|
||||
|
||||
/**
|
||||
* Gets or, when options are provided, sets the limits of _libvips'_ operation cache.
|
||||
@@ -176,5 +193,6 @@ module.exports = function (Sharp) {
|
||||
Sharp.format = format;
|
||||
Sharp.interpolators = interpolators;
|
||||
Sharp.versions = versions;
|
||||
Sharp.vendor = vendor;
|
||||
Sharp.queue = queue;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user