Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

vimagination.zapto.org/memfs

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vimagination.zapto.org/memfs

Go Modules
Version
v1.1.1
Version published
Created
Source

memfs

CI Go Reference Go Report Card

-- import "vimagination.zapto.org/memfs"

Package memfs contains both ReadOnly and ReadWrite implementations of an in-memory FileSystem, supporting all of the FS interfaces and more.

Highlights

  • Full in-memory file system implementation.
  • Implements fs.FS, fs.ReadDirFS, fs.ReadDirFile, fs.ReadFileFS, fs.StatFS, and fs.SubFS.
  • Supports symlinks and hardlinks.
  • Handles metadata operations and permissions.
  • Can convert a read-write FS into a read-only one to remove locking and related overhead.

Usage

package main

import (
	"fmt"
	"io"

	"vimagination.zapto.org/memfs"
)

func main() {
	fs := memfs.New()

	fs.Mkdir("example", 0700)

	file, _ := fs.Create("example/file.txt")
	io.WriteString(file, "Hello, World!")
	file.Close()

	contents, _ := fs.ReadFile("example/file.txt")

	fmt.Printf("read: %q", contents)

	// Output:
	// read: "Hello, World!"
}

Documentation

Full API docs can be found at:

https://pkg.go.dev/vimagination.zapto.org/memfs

FAQs

Package last updated on 24 Sep 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