How to use the sharp.versions function in sharp

To help you get started, we’ve selected a few sharp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github expo / expo-cli / packages / image-utils / src / sharp.ts View on Github external
async function findSharpBinAsync(): Promise {
  if (_sharpBin) {
    return _sharpBin;
  }
  const requiredCliVersion = require('../package.json').peerDependencies['sharp-cli'];
  try {
    const sharpCliPackage = require('sharp-cli/package.json');
    const libVipsVersion = require('sharp').versions.vips;
    if (
      sharpCliPackage &&
      semver.satisfies(sharpCliPackage.version, requiredCliVersion) &&
      typeof sharpCliPackage.bin.sharp === 'string' &&
      typeof libVipsVersion === 'string'
    ) {
      _sharpBin = require.resolve(`sharp-cli/${sharpCliPackage.bin.sharp}`);
      return _sharpBin;
    }
  } catch (e) {
    // fall back to global sharp-cli
  }

  let installedCliVersion;
  try {
    installedCliVersion = (await spawnAsync('sharp', ['--version'])).stdout.toString().trim();
github piobyte / flamingo / targets / bench / fingerprint.js View on Github external
function fingerprint() {
  /* eslint no-sync: 0 */
  return {
    os: {
      type: os.type(),
      platform: os.platform(),
      arch: os.arch(),
      release: os.release(),
      totalMem: os.totalmem(),
      freeMem: os.freemem(),
      cpus: os.cpus()
    },
    libs: {
      node: process.versions,
      vips: sharp.versions.vips
    }
  };
}
github WagonOfDoubt / kotoba.js / app / src / index.js View on Github external
const initApp = () => {
  const app = express();
  // set native express vars
  app.set('views', './templates');
  app.set('view engine', 'pug');
  // set custom express vars
  app.set('kot_routes', require('./utils/routes')(routes.stack));
  app.set('kot_mongoose_version', mongoose.version);
  app.set('kot_sharp_versions', require('sharp').versions);

  // middlewares
  app.use(globalTemplateVariables);
  app.use(require('express-useragent').express());
  app.use(require('connect-flash')());
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: true }));
  configureAuthentication(app);
  // this middleware MUST be added last, or everything above won't work
  app.use(routes);

  connectToDatabase(app)
    .then(() => Promise.all([
      ensureMainPage(),
      Style.ensureDefaults(),
    ]))

sharp

High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images

Apache-2.0
Latest version published 1 month ago

Package Health Score

94 / 100
Full package analysis