Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

memory-fs

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memory-fs

A simple in-memory filesystem. Holds data in a javascript object.

  • 0.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.7M
decreased by-56.84%
Maintainers
1
Weekly downloads
 
Created

What is memory-fs?

The memory-fs npm package is an in-memory filesystem that mimics the Node.js fs module. It allows you to create, read, write, and delete files and directories in memory, which can be useful for testing or when you need a temporary filesystem that does not interact with the actual disk.

What are memory-fs's main functionalities?

Creating and writing files

This feature allows you to create new files and write content to them, similar to fs.writeFileSync in Node.js.

{"const MemoryFS = require('memory-fs');\nconst fs = new MemoryFS();\nfs.writeFileSync('/my-file.txt', 'Hello World');"}

Reading files

This feature allows you to read the contents of files that exist in the in-memory filesystem.

{"const MemoryFS = require('memory-fs');\nconst fs = new MemoryFS();\nfs.writeFileSync('/my-file.txt', 'Hello World');\nconst content = fs.readFileSync('/my-file.txt', 'utf-8');"}

Creating directories

This feature allows you to create directories within the in-memory filesystem.

{"const MemoryFS = require('memory-fs');\nconst fs = new MemoryFS();\nfs.mkdirSync('/my-directory');"}

Deleting files and directories

This feature allows you to delete files and directories from the in-memory filesystem.

{"const MemoryFS = require('memory-fs');\nconst fs = new MemoryFS();\nfs.writeFileSync('/my-file.txt', 'Hello World');\nfs.unlinkSync('/my-file.txt');\nfs.mkdirSync('/my-directory');\nfs.rmdirSync('/my-directory');"}

Other packages similar to memory-fs

Keywords

FAQs

Package last updated on 06 Dec 2016

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc