feat: allow sharing backing store across in-memory file systems
6 files changed
tree: 3e6c1fdc441291a8a6f804af96f8112f23c15cfe
  1. contrib/
  2. lib/
  3. test/
  4. tool/
  5. .gitignore
  6. .travis.yml
  7. LICENSE
  8. pubspec.yaml
  9. README.md
README.md

Build Status Coverage Status

File

A generic file system abstraction for Dart.

This package is currently experimental and subject to change

Like dart:io, package:file supplies a rich Dart idiomatic API for accessing a file system.

Unlike dart:io, package:file:

  • Has an entirely async public interface (no fooSync methods).
  • Has explicit factory classes for different implementations.
  • Can be used to implement custom file systems.

Usage

Implement your own custom file system:

import 'package:file/file.dart';

class FooBarFileSystem implements FileSystem { ... }

Use the in-memory file system:

import 'package:file/file.dart';

var fs = new InMemoryFileSystem();

Use the local file system (requires dart:io access):

import 'package:file/io.dart';

var fs = const LocalFileSystem();