# spf13/afero

The Universal Filesystem Abstraction for Go

Repository: https://github.com/spf13/afero
Canonical: https://ross.abutalabs.com/products/afero
Language: Go
License: Apache-2.0
License Family: permissive
Topics: compression, filesystem, fs, go, golang, network-file-system, network-file-transfer, vfs, virtual
Last push: 2026-08-14T20:03:21+00:00

## Health v2 (maintenance only)
Score: 76/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 97, release rhythm 35, longevity 100
- inputs: {"age_days": 4327, "days_push": 19, "days_rel": 359, "gap_med": 64, "n_releases_24m": 4}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 6692, forks 570 (observed 2026-08-28T04:09:47.754327+00:00)

## What it is
Afero is a filesystem abstraction library for Go that provides a universal interface over multiple storage backends, including local disk, in-memory, archives, and remote systems. It acts as a drop-in replacement for the standard os package, enabling easy testing and composable filesystem layers like caching, sandboxing, and path restriction.

## Use cases
- mock the filesystem in Go unit tests
- swap file storage backends without changing application code
- sandbox file access to a subdirectory
- cache reads from a slow network filesystem
- read and write files inside zip or tar archives
- make Go code portable across local, cloud, and remote storage

## When to choose
- you need fast, isolated filesystem tests without touching disk
- you want to abstract storage backends behind one interface
- you need layered filesystem behaviors like copy-on-write or caching
- you want os-package-compatible file APIs with io/fs support

## When to avoid
- you only ever touch the local disk and never test file logic
- you need a POSIX-compliant full filesystem implementation
- your code depends on os-specific features outside the abstraction

## Facets
- artifact type: library
- maturity: stable
- function: file-system, testing, mocking
- domain: developer-tools, files, testing
- platform: go, cross-platform
- tags: filesystem-abstraction, vfs, in-memory-filesystem, drop-in-replacement, os-package

## Member repositories
- spf13/afero (main) score 76

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:47.754327+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:42:58.889049+00:00, confidence not recorded.
  - readme: https://github.com/spf13/afero (fetched 2026-08-28T04:09:47.754327+00:00, sha 6c6ed3a76fd3)
- Data as of 2026-08-30T08:39:29.467469+00:00.
