fs_shim 0.10.2 copy "fs_shim: ^0.10.2" to clipboard
fs_shim: ^0.10.2 copied to clipboard

outdated

A portable file system implementation working on io, browser and memory (through idb_shim)

example/example.dart

import 'dart:async';

import 'package:fs_shim/fs.dart';
import 'package:fs_shim/fs_memory.dart';
import 'package:path/path.dart';

Future main() async {
  FileSystem fs = newMemoryFileSystem();

  // Create a top level directory
  Directory dir = fs.directory('/dir');

  // and a file in it
  File file = fs.file(join(dir.path, "file"));

  // create a file
  await file.create(recursive: true);
  await file.writeAsString("Hello world!");

  // read a file
  print('file: ${await file.readAsString()}');

  // use a file link if supported
  if (fs.supportsFileLink) {
    Link link = fs.newLink(join(dir.path, "link"));
    await link.create(file.path);

    print('link: ${await fs.file(link.path).readAsString()}');
  }

  // list dir content
  print(await dir.list(recursive: true, followLinks: true).toList());
}
6
likes
0
pub points
85%
popularity

Publisher

verified publishertekartik.com

A portable file system implementation working on io, browser and memory (through idb_shim)

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

idb_shim, path

More

Packages that depend on fs_shim