Skip to content

Instantly share code, notes, and snippets.

@aredridel
Last active December 31, 2015 00:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aredridel/7905419 to your computer and use it in GitHub Desktop.
Save aredridel/7905419 to your computer and use it in GitHub Desktop.
Minimal filesystem-like API

Minimal Filesystem-like API

No sync versions of functions. These may encapsulate high-latency remote filesystems. Including sync operations is inappropriate.

fs.rename

fs.stat

May return only minimal information for an entry.

fs.unlink

May return an error for read-only filesystems.

fs.rmdir

May return an error for read-only filesystems.

fs.mkdir

May return an error for read-only filesystems.

fs.readdir

fs.open

fs.close

This is an asynchronous operation that can return a fair number of errors for writable files.

fs.readFile

fs.createReadStream

fs.writeFile

May return errors for a read-only filesystem.

fs.createWriteStream

May return errors for a read-only filesystem.

fs.appendFile

May return errors for a read-only filesystem.

fs.exists

Unix-like Additions

fs.truncate

May return errors for a read-only filesystem.

fs.chown

May return errors for a read-only filesystem.

fs.lchown

May return errors for a read-only filesystem.

fs.chmod

May return errors for a read-only filesystem.

fs.lchmod

May return errors for a read-only filesystem.

fs.lstat

May return errors for a read-only filesystem.

fs.link

May return errors for a read-only filesystem.

fs.symlink

May return errors for a read-only filesystem.

fs.readlink

May return errors for a read-only filesystem.

@aredridel
Copy link
Author

A lateral walk operation is probably needed -- for filesystems that are object stores, 'open by path' is often a chain of operations.

@aredridel
Copy link
Author

You'll probably notice that a lot of these map straight to 9P2000/9P2000.U operations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment