curl "https://shork.easrng.net/$(stty size|tr ' ' _)"
@easrng sauce code please
code inside (nodejs)
// @minervissa Here you go! Probably not the best code but it works.
const express = require("express");
const pngStringify = require("console-png");
const sharp = require("sharp");
const fs = require("fs");
const app = express();
app.get("/:s", async (req, res, next) => {
try {
const [h, w] = decodeURIComponent(req.params.s).trim().split(/\D+/);
pngStringify(
await sharp("shork.png")
.resize(Math.floor(Math.min(+w, 2 * +h) || 24))
.png()
.toBuffer(),
function (err, string) {
if (err) next(err);
res.send("\x1b[48;5;231m\x1b[H\x1b[2J\x1b[3J" + string + "\x1b[H");
}
);
} catch (e) {
next(e);
}
});
const listener = app.listen(process.env.PORT, () => {
console.log("Your app is listening on port " + listener.address().port);
});
code inside (nodejs)
@easrng wowwww you even made it go from a .png! I thought you hardcoded the escape sequences for each pixel into an array or something
This is awesome!
@easrng pumping out cool stuff at a fast pace I see