diff options
Diffstat (limited to 'docs/interface.rst')
-rw-r--r-- | docs/interface.rst | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/docs/interface.rst b/docs/interface.rst index f2ba77c..0b4af59 100644 --- a/docs/interface.rst +++ b/docs/interface.rst @@ -5,9 +5,9 @@ It requires a relatively small number of methods to implement a working FS objec If you are looking to implement a working FS object, derive a class from fs.base.FS and implement the essential methods (below). Be sure to convert all exceptions to instances of :class:`fs.errors.FSError`. -It may also be worthwhile implementing some of the non-essential methods, as the default implementations may not be optimal. For example, the method :meth:`fs.base.FS.move` is implemeneted as a file copy followed by a delete, but may filesystems can move a file without copying data. +It may also be worthwhile implementing some of the non-essential methods, as the default implementations may not be optimal. For example, the method :meth:`fs.base.FS.move` is implemeneted as a file copy followed by a delete, but many filesystems can move a file without copying data. -If the filesystem you are implementing maps path to the native filesystem, be sure to implement `getsyspath`. Doing so will improve performance, especialy when copying / moving files between FS objects. +If the filesystem you are implementing maps paths to the native filesystem, be sure to implement `getsyspath`. Doing so will improve performance, especialy when copying / moving files between FS objects. Essential Methods ----------------- @@ -35,8 +35,14 @@ The following methods have default implementations in fs.base.FS and aren't requ * :meth:`~fs.base.FS.desc` Return a short destriptive text regarding a path * :meth:`~fs.base.FS.exists` Check whether a path exists as file or directory * :meth:`~fs.base.FS.listdirinfo` Get a directory listing along with the info dict for each entry + * :meth:`~fs.base.FS.ilistdir` Generator version of the listdir method + * :meth:`~fs.base.FS.ilistdirinfo` Generator version of the listdirinfo method * :meth:`~fs.base.FS.getsyspath` Get a file's name in the local filesystem, if possible * :meth:`~fs.base.FS.hassyspath` Check if a path maps to a system path (recognised by the OS) + * :meth:`~fs.base.FS.getpathurl` Get an external URL at which the given file can be accessed, if possible + * :meth:`~fs.base.FS.haspathurl` Check if a path maps to an external URL + * :meth:`~fs.base.FS.getmeta` Get the value of a filesystem meta value, if it exists + * :meth:`~fs.base.FS.hasmeta` Check if a filesystem meta value exists * :meth:`~fs.base.FS.move` Move a file to a new location * :meth:`~fs.base.FS.movedir` Recursively move a directory to a new location * :meth:`~fs.base.FS.opendir` Opens a directory and returns an FS object that represents it @@ -47,10 +53,11 @@ The following methods have default implementations in fs.base.FS and aren't requ Utility Methods --------------- -The following members have implementations in fs.base.FS but will probably never require a non-default implementation, although there is nothing to prevent a derived class from implementing these: +The following members have implementations in fs.base.FS and will probably never require a non-default implementation, although there is nothing to prevent a derived class from implementing these: * :meth:`~fs.base.FS.createfile` Create a file with data * :meth:`~fs.base.FS.getcontents` Returns the contents of a file as a string + * :meth:`~fs.base.FS.setcontents` Sets the contents of a file as a string or file-like object * :meth:`~fs.base.FS.getsize` Returns the number of bytes used for a given file or directory * :meth:`~fs.base.FS.isdirempty` Checks if a directory contains no files * :meth:`~fs.base.FS.makeopendir` Creates a directroy (if it exists) and returns an FS object for that directory |