Skip to content

Instantly share code, notes, and snippets.

@d2m
Created January 29, 2012 02:36
Show Gist options
  • Save d2m/1696850 to your computer and use it in GitHub Desktop.
Save d2m/1696850 to your computer and use it in GitHub Desktop.
Read/write files server-side under frogsh/minfrog
/**
* location: dart/frog/file_system_node.dart
* library: file_system_node
* class: NodeFileSystem
* File system implementation using nodejs api's (for self-hosted compiler).
*/
#import('../../frog/file_system_node.dart');
NodeFileSystem _fs = new NodeFileSystem();
// Read a file (uses readFileSync())
String filename = 'name.ext';
String filecontents = _fs.readAll(filename);
// Write a file (uses writeFileSync())
String filecontents = '...';
_fs.writeString(filename, filecontents);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment