import express from 'express';
import gm from 'gm';
import fs from 'fs';
let app = express();
let imagePath = __dirname + '/images/';
let image404 = 'notfound.jpg';
let imagePool = fs.readdirSync(imagePath).filter(fname => fname !== image404);
// number, high boundary, low boundary
let clamp = (n, h, l) => Math.max(Math.min(n, h), l);
// takes list and returns a random value. pretty inefficiently as well.
let randomFromList = list => [...list].sort(() => Math.random() > .5).pop();
function streamImage(req, res, img = randomFromList(imagePool)) {