Socket
Book a DemoInstallSign in
Socket

cloudflare-fs

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloudflare-fs

This package implements an opinionated durable object powered file-system that aims to replicate the exact node `fs/promises` api and make it available in workers.

0.0.2
latest
npmnpm
Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

This package implements an opinionated durable object powered file-system that aims to replicate the exact node fs/promises api and make it available in workers.

npm i cloudflare-fs

Usage:

// worker.js
import { writeFile, DOFS } from "cloudflare-fs";
export { DOFS };
export default {
  fetch: async (request) => {
    await writeFile("/latest-request.txt", request.url, "utf8");
    return new Response("written!");
  },
};

Add to your wrangler.toml

[[durable_objects.bindings]]
name = "DOFS"
class_name = "DOFS"

[[migrations]]
tag = "v1"
new_sqlite_classes = ["DOFS"]

Limitations compared to Node.js fs:

  • No streaming APIs - missing createReadStream, createWriteStream
  • No sync versions - missing readFileSync, writeFileSync, etc.
  • No watch functionality - missing watch, watchFile
  • No advanced features - missing link, symlink, readlink, chmod, chown
  • No file descriptors - missing open, close, read, write with fd
  • Cross-instance operations are simplified and may be slower
  • No proper error codes - Node.js fs uses specific error codes like ENOENT, EISDIR
  • Limited encoding support - only basic TextEncoder/TextDecoder
  • Limited max filesize - capped at the max rowsize of 2MB
  • Limited max total disk size - capped at 10GB per disk*

How do disks work?

  • every username in paths starting with /Users/{username} becomes its own disk (DO)
  • anything else goes to the 'default' disk.

FAQs

Package last updated on 20 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.