---
title: "Discussion on \"Why Node.js needs a virtual file system\" | Hashnode"
description: "Discussion on \"Why Node.js needs a virtual file system\". Node.js now has a virtual filesystem. Learn why VFS matters for testing, sandboxing, Single Executable Apps, and running generated code directly in me"
url: "https://hashnode.com/posts/why-nodejs-needs-a-virtual-file-system/69b81409bac260df04ac02f7"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Why Node.js needs a virtual file system](https://blog.platformatic.dev/why-nodejs-needs-a-virtual-file-system?utm_source=hashnode&utm_medium=feed)

Node.js now has a virtual filesystem. Learn why VFS matters for testing, sandboxing, Single Executable Apps, and running generated code directly in me

Mar 16 · 10 min read · blog.platformatic.dev  
Updated Mar 17  
Read the article

-   [#nodejs](https://hashnode.com/tag/nodejs)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#backend](https://hashnode.com/tag/backend)
-   [#developer](https://hashnode.com/tag/developer)

## Written by

[Matteo Collina](https://hashnode.com/@matteocollina)

@matteocollina

  
[View profile](https://hashnode.com/@matteocollina)

Open Sourcerer, Node.js TSC member, Fastify Lead Maintainer

## Responses 2

Markdown supported · ⌘↵ to post

[Priya Sharma](https://hashnode.com/@priya_codes)

[Mar 16](https://hashnode.com/posts/why-nodejs-needs-a-virtual-file-system/69b81409bac260df04ac02f7/comment/69b83daa2ad6ae5184d1d639)

does the mount work across worker threads or is it scoped to the main thread?

[Jake Morrison](https://hashnode.com/@jakebuilds)

[Mar 16](https://hashnode.com/posts/why-nodejs-needs-a-virtual-file-system/69b81409bac260df04ac02f7/comment/69b83d752ad6ae5184d1a981)

the AI agent use case is the one that got me. i've been writing generated code to temp files and then cleaning up after and it always felt wrong. keeping it in memory and importing directly makes so much more sense.

haven't tried this yet but the testing example with the using statement is really clean. no more forgetting to delete temp dirs in CI.
