Cloudflare changelogs | Developer platform
Cloudflare changelogs for Developer platform products
马上订阅 Cloudflare changelogs | Developer platform RSS 更新: https://developers.cloudflare.com/changelog/rss/developer-platform.xml
Workers - The Node.js and Web File System APIs in Workers
Implementations of the node:fs module and the Web File System API are now available in Workers.
Using the node:fs module
The node:fs module provides access to a virtual file system in Workers. You can use it to read and write files, create directories, and perform other file system operations.
The virtual file system is ephemeral with each individual request havig its own isolated temporary file space. Files written to the file system will not persist across requests and will not be shared across requests or across different Workers.
Workers running with the nodejs_compat compatibility flag will have access to the node:fs module by default when the compatibility date is set to 2025-09-01 or later. Support for the API can also be enabled using the enable_nodejs_fs_module compatibility flag together with the nodejs_compat flag. The node:fs module can be disabled using the disable_nodejs_fs_module compatibility flag.
import fs from "node:fs";
const config = JSON.parse(fs.readFileSync("/bundle/config.json", "utf-8"));
export default { async fetch(request) { return new Response(`Config value: ${config.value}`); },};There are a number of initial limitations to the node:fs implementation:...
剩余内容已隐藏