Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonathan Vilella vilellaj

View GitHub Profile
View sharp.js
const fs = require('fs');
const sharp = require('sharp');
fs.readdirSync('./images').forEach(file => {
const buff = fs.readFileSync(`./images/${file}`);
sharp(buff).toFile('images/output.webp', (err, info) => {
if (err)
console.error(err);
@vilellaj
vilellaj / divideInEqualParts.js
Last active Jan 16, 2017
Given a number, divide it in equal parts respecting a limit, returning the value of a part.
View divideInEqualParts.js
divideInEqualParts(value, limit)
{
let result = (value / 2);
return (result > limit ? divideInEqualParts(result, limit) : result);
}
You can’t perform that action at this time.