{"_id":"@beroburny/workers-og","name":"@beroburny/workers-og","dist-tags":{"latest":"0.0.14"},"versions":{"0.0.14":{"name":"@beroburny/workers-og","type":"module","main":"./dist/index.js","module":"./dist/index.js","exports":{".":{"import":"./dist/index.js","require":"./dist/index.js"}},"types":"./dist/index.d.ts","version":"0.0.14","devDependencies":{"@cloudflare/workers-types":"^4.20230814.0","@types/node":"^20.5.1","esbuild":"^0.18.20","esbuild-plugin-d.ts":"^1.1.0","typescript":"^5.1.6"},"private":false,"scripts":{"build":"node bin/esbuild.js","ts":"tsc --noEmit"},"dependencies":{"@resvg/resvg-wasm":"^2.4.1","just-camel-case":"^6.2.0","satori":"^0.10.3","yoga-wasm-web":"^0.3.3"},"gitHead":"6effa326fb10209e72523806ff2d45032ddfd365","description":"> Using Vercel's [Satori](https://github.com/vercel/satori) engine, and many credits to [`@vercel/og`](https://vercel.com/docs/concepts/functions/edge-functions/og-image-generation) for the inspiration.","_id":"@beroburny/workers-og@0.0.14","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-ZuGjmjqoHvgqLSJiN1hUDHyClV5IUN5rqBs6cgYJ9BrlowZDUkdTqaLubeb24Hsuchp9K/rIPHQoJEl0okEc9g==","shasum":"08feca597653ee4423398ab4853fab6051f2038d","tarball":"https://registry.npmjs.org/@beroburny/workers-og/-/workers-og-0.0.14.tgz","fileCount":19,"unpackedSize":3663591,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICxY0mswOHjuIq3fqTHD+CTjWdgJSwMdm7MoazXi/6fnAiEA3xjCPwsf9XWnzAaSWjIU26rLVQj7Q27reHo5fpopnLU="}]},"_npmUser":{"name":"beroburny","email":"bero4net@gmail.com"},"directories":{},"maintainers":[{"name":"beroburny","email":"bero4net@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/workers-og_0.0.14_1699354006772_0.17067357425534735"},"_hasShrinkwrap":false}},"time":{"created":"2023-11-07T10:46:46.689Z","0.0.14":"2023-11-07T10:46:47.043Z","modified":"2023-11-07T10:46:47.289Z"},"maintainers":[{"name":"beroburny","email":"bero4net@gmail.com"}],"description":"> Using Vercel's [Satori](https://github.com/vercel/satori) engine, and many credits to [`@vercel/og`](https://vercel.com/docs/concepts/functions/edge-functions/og-image-generation) for the inspiration.","readme":"# Cloudflare Workers OG Image Generator\n\n> Using Vercel's [Satori](https://github.com/vercel/satori) engine, and many credits to [`@vercel/og`](https://vercel.com/docs/concepts/functions/edge-functions/og-image-generation) for the inspiration.\n\nAn `og:image` (social card) generator that is fast, browser-less (no Puppeteer), and capable of running on the edge.\n\nThis package is designed to be used with Cloudflare Workers (but may be used elsewhere), with the simple API inspired by `@vercel/og`.\n\n## Difference from `@vercel/og`\n\n`@vercel/og` is designed to run on Vercel's edge runtime, and `workers-og` on Cloudflare Workers.\n\nWhile `satori` (used in both `@vercel/og` and `workers-og`) accepts React element as the input, `workers-og` adds a feature which allows you to write a simple HTML, which will here be parsed into React element-like object.\n\n## Example Usage on a Worker:\n\n```typescript\nimport { ImageResponse } from \"workers-og\";\n\nexport default {\n  async fetch(\n    request: Request,\n    env: Env,\n    ctx: ExecutionContext\n  ): Promise<Response> {\n    const params = new URLSearchParams(new URL(request.url).search);\n    const title = params.get(\"title\") || \"Lorem ipsum\";\n\n    const html = `\n    <div style=\"display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; width: 100vw; font-family: sans-serif; background: #160f29\">\n      <div style=\"display: flex; width: 100vw; padding: 40px; color: white;\">\n        <h1 style=\"font-size: 60px; font-weight: 600; margin: 0; font-family: 'Bitter'; font-weight: 500\">${title}</h1>\n      </div>\n    </div>\n   `;\n\n    return new ImageResponse(html, {\n      width: 1200,\n      height: 630,\n    });\n  },\n};\n```\n","readmeFilename":"README.md"}