Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.process = function (fullImagePath, fullImagePathResult, size, callback) {
// Disable experimental SIMD support - this is the default behaviour
sharp.simd(false);
sharp(fullImagePath)
.resize(size[0], size[1])
.toFile(fullImagePathResult, callback);
}
import sharp from 'sharp';
import rp from 'request-promise-native';
import config from 'config';
sharp.cache(config.imageable.cache);
sharp.concurrency(config.imageable.concurrency);
sharp.counters(config.imageable.counters);
sharp.simd(config.imageable.simd);
export async function downloadImage (url) {
const response = await rp.get(url, { encoding: null });
return response
}
export async function identify (buffer) {
try {
const transformer = sharp(buffer);
return transformer.metadata();
} catch (err) {
console.log(err);
}
}
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var fs = require("fs");
var path = require("path");
var Promise = require("bluebird");
var sharp = require("sharp");
var _require = require("./common.js"),
defaultIcons = _require.defaultIcons,
doesIconExist = _require.doesIconExist;
sharp.simd(true);
function generateIcons(icons, srcIcon) {
return Promise.map(icons, function (icon) {
var size = parseInt(icon.sizes.substring(0, icon.sizes.lastIndexOf("x")));
var imgPath = path.join("public", icon.src);
return sharp(srcIcon).resize(size).toFile(imgPath).then(function () {});
});
}
exports.onPostBuild = function _callee(_ref, pluginOptions) {
var graphql, icon, manifest, _ref2, data, siteTitle, iconPath;
return _regenerator.default.async(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
const path = require('path')
const kebabCase = require('lodash.kebabcase')
const moment = require('moment')
const siteConfig = require('./data/SiteConfig')
const sharp = require('sharp')
sharp.simd(false)
sharp.cache(false)
const postNodes = []
function addSiblingNodes(createNodeField) {
postNodes.sort(({ frontmatter: { date: date1 } }, { frontmatter: { date: date2 } }) => {
const dateA = moment(date1, siteConfig.dateFromFormat)
const dateB = moment(date2, siteConfig.dateFromFormat)
if (dateA.isBefore(dateB)) return 1
if (dateB.isBefore(dateA)) return -1
return 0
})
for (let i = 0; i < postNodes.length; i += 1) {