emptygif
Language: English

All languages and frameworks

Elysia TypeScript

A TypeScript snippet for Elysia that answers requests for /pixel.gif with the empty GIF, decoded once at startup.

Elysia TypeScript

Install
bun add elysia
File
server.ts
Run
bun server.ts
import { Elysia } from 'elysia';

const GIF = Buffer.from('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==', 'base64');

new Elysia()
  .get('/pixel.gif', ({ set }) => {
    set.headers['content-type'] = 'image/gif';
    set.headers['cache-control'] = 'no-store';
    return GIF;
  })
  .listen(8080);

We ran this snippet and compared the bytes it returned.

Check it

curl -sI http://localhost:8080/pixel.gif

Official site: Elysia

More in TypeScript