@vercel/og but it works with Node.js
Go to file
m5r 0008ab1fd7
release 0.1.3
2023-04-02 15:46:14 +02:00
src also use emojiType as cache key for dynamic asset cache 2023-02-16 09:24:03 +01:00
vendor add fallback font 2023-02-14 20:26:27 +01:00
.gitignore init 2023-02-14 20:26:11 +01:00
LICENSE init 2023-02-14 20:26:11 +01:00
README.md update readme 2023-02-14 20:28:28 +01:00
package-lock.json release 0.1.3 2023-04-02 15:46:14 +02:00
package.json release 0.1.3 2023-04-02 15:46:14 +02:00
tsconfig.json init 2023-02-14 20:26:11 +01:00

README.md

@m5r/og

@vercel/og but it works with Node.js

API Reference

The API is compatible with @vercel/og.

The package exposes an ImageResponse constructor, with the following options available:

import type { ReactElement } from "react";
import { ImageResponse } from "@vercel/og";

new ImageResponse(
  element: ReactElement,
  options: {
    width?: number = 1200
    height?: number = 630
    emoji?: "twemoji" | "blobmoji" | "noto" | "openmoji" | "fluent" | "fluentFlat" = "twemoji",
    fonts?: {
      name: string,
      data: ArrayBuffer,
      weight: number,
      style: "normal" | "italic"
    }[]
    debug?: boolean = false

    // Options that will be passed to the HTTP response
    status?: number = 200
    statusText?: string
    headers?: Record<string, string>
  },
);

When running in production, these headers will be included:

"content-type": "image/png",
"cache-control": "public, immutable, no-transform, max-age=31536000",

During development, the cache-control: no-cache, no-store header is used instead.

Acknowledgements

This project will not be possible without the following projects: