Skip to main content

microfs 1.0.1 copy "microfs: ^1.0.1" to clipboard
microfs: ^1.0.1 copied to clipboard

A minimal filesystem stored in a single binary container, implementing the package:file FileSystem interface.

A minimal filesystem stored in a single binary container. Files are stored in fixed-size blocks inside any RandomAccessFile — a local file, an in-memory buffer, or any other backing store. The filesystem implements the package:file FileSystem interface, so it works with any code that accepts a FileSystem.

Features #

  • Stores a flat collection of files in a single binary container
  • Block-based allocation with automatic container growth
  • Implements the package:file FileSystem interface
  • Fully async — backed by RandomAccessFile
  • Containers are portable: format once, mount anywhere

Getting started #

Add to your pubspec.yaml:

dependencies:
  microfs: ^1.0.0
  file: ^7.0.0

Usage #

Format a new container #

import 'package:file/local.dart';
import 'package:microfs/microfs.dart';

final localFs = LocalFileSystem();
final tempDir = await localFs.systemTempDirectory.createTemp('myapp_');
final raf = await tempDir.childFile('data.bin').open(mode: FileMode.write);

final fs = await MicroFileSystem.format(
  raf,
  blockSize: 4096,
  maxBlocksPerFile: 8,
);

Write and read files #

await fs.file('notes.txt').writeAsString('Hello, microfs!');

final contents = await fs.file('notes.txt').readAsString();
print(contents); // Hello, microfs!

final bytes = await fs.file('image.png').readAsBytes();

List files #

await for (final entity in fs.currentDirectory.list()) {
  print(entity.path);
}

Mount an existing container #

final raf = await localFs.file('data.bin').open();
final fs = await MicroFileSystem.mount(raf);

Limitations #

  • Flat namespace only — no subdirectories
  • No synchronous API (sync methods throw UnsupportedError)
  • No symbolic links
  • No file watching
  • Filenames are UTF-8, max 48 bytes (path separators are permitted within that limit)
0
likes
0
points
22
downloads

Publisher

verified publisherhedgehogfortress.uk

Weekly Downloads

A minimal filesystem stored in a single binary container, implementing the package:file FileSystem interface.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

file, path

More

Packages that depend on microfs