emptygif
Lingua: Italiano

Tutti i linguaggi e framework

AWS Lambda (Node.js) JavaScript

Uno snippet JavaScript per AWS Lambda (Node.js) che risponde alle richieste a /pixel.gif con la GIF vuota, decodificata una sola volta all'avvio.

AWS Lambda (Node.js) JavaScript

File
index.mjs
// index.mjs - behind an API Gateway HTTP API route "GET /pixel.gif" or a function URL.
// Binary bodies travel base64-encoded, so the GIF stays in base64 here.
const GIF_BASE64 = 'R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';

export const handler = async () => ({
  statusCode: 200,
  headers: { 'Content-Type': 'image/gif', 'Cache-Control': 'no-store' },
  body: GIF_BASE64,
  isBase64Encoded: true,
});

Abbiamo eseguito questo snippet e confrontato i byte che ha restituito.

Verifica

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

Sito ufficiale: AWS Lambda (Node.js)

Altro in JavaScript