Install Web API polyfills for Node.js environments.
/**
* 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();@sveltejs/kit/node/polyfillscrypto: Web Crypto APIFile: File APIFormData, Headers, Request, and Response are NOT polyfilled by this function - they are available natively in Node.js 18+