or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

examples

edge-cases.mdreal-world-scenarios.md
index.md
tile.json

nodejs-polyfills.mddocs/reference/

Node.js Polyfills

Install Web API polyfills for Node.js environments.

Capabilities

Install Polyfills

/**
 * Install Web API polyfills as globals in Node.js
 * Adds: crypto, File
 * @returns void
 */
function installPolyfills(): void;

Usage:

import { installPolyfills } from '@sveltejs/kit/node/polyfills';

// Call before using Web APIs in Node.js
installPolyfills();

// Now these APIs are available as globals
const file = new File(['content'], 'filename.txt');
crypto.randomUUID();

Notes

  • Import from @sveltejs/kit/node/polyfills
  • Call once at application startup
  • Makes Web APIs available as globals in Node.js
  • Polyfills include:
    • crypto: Web Crypto API
    • File: File API
  • Note: FormData, Headers, Request, and Response are NOT polyfilled by this function - they are available natively in Node.js 18+
  • Required for some adapters (e.g., adapter-node) when using File or crypto APIs
  • Node.js 18+ includes most Web APIs natively