Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
api:filesystem [2015/02/01 00:39]
solra_bizna [Filesystem API] Document an important semantic of filesystem.segments that I forgot about
api:filesystem [2020/07/25 22:58] (current)
saphire Added link to Filesystem component
Line 1: Line 1:
 Filesystem API Filesystem API
 ============ ============
-This library allows a general way of interacting with file system components. While each component is it's own "​folder",​ these folders can be "​mounted"​ somewhere into a global directory tree. This allows seamlessly interacting on multiple file system components.+This library allows a general way of interacting with file system components. While each component is it's own "​folder",​ these folders can be "​mounted"​ somewhere into a global directory tree. This allows seamlessly interacting on multiple file system components. Not to be confused with the [[component:​filesystem|Filesystem component]] with which this API works.
  
 - `filesystem.isAutorunEnabled():​ boolean`  ​ - `filesystem.isAutorunEnabled():​ boolean`  ​
Line 27: Line 27:
 - `filesystem.mount(fs:​ table or string, path: string): boolean or nil, string`  ​ - `filesystem.mount(fs:​ table or string, path: string): boolean or nil, string`  ​
   Mounts a file system at the specified path. The first parameter can be either a file system component'​s proxy, its address or its label. The second is a path into the global directory tree. Returns true if the file system was successfully mounted, `nil` and an error message otherwise.   Mounts a file system at the specified path. The first parameter can be either a file system component'​s proxy, its address or its label. The second is a path into the global directory tree. Returns true if the file system was successfully mounted, `nil` and an error message otherwise.
-  Hard disks, floppy disks, and the /tmp filesystem are accessed via a proxy of an actual [[component:​filesystem|Filesystem component]]. By passing to `filesystem.mount` your own "​proxy"​ table that implements its own equivalents to that component'​s operations, you can make your own filesystems. Compression,​ encryption, union mounts, software RAID, and networking are just a few possibilities. 
 - `filesystem.mounts():​ function -> table, string`  ​ - `filesystem.mounts():​ function -> table, string`  ​
   Returns an iterator function over all currently mounted file system component'​s proxies and the paths at which they are mounted. This means the same proxy may appear multiple times, but with different mount paths.   Returns an iterator function over all currently mounted file system component'​s proxies and the paths at which they are mounted. This means the same proxy may appear multiple times, but with different mount paths.
Line 45: Line 44:
   Gets whether the path points to a directory. Returns false if not, either because the path points to a file, or `file.exists(path)` is false.   Gets whether the path points to a directory. Returns false if not, either because the path points to a file, or `file.exists(path)` is false.
 - `filesystem.lastModified(path:​ string): number`  ​ - `filesystem.lastModified(path:​ string): number`  ​
-  Returns the *real world* ​unicode ​timestamp of the last time the file at the specified path was modified. For directories this is usually the time of their creation.+  Returns the *real world* ​unix timestamp of the last time the file at the specified path was modified. For directories this is usually the time of their creation.
 - `filesystem.list(path:​ string): function -> string or nil, string`  ​ - `filesystem.list(path:​ string): function -> string or nil, string`  ​
   Returns an iterator over all elements in the directory at the specified path. Returns `nil` and an error messages if the path is invalid or some other error occurred.  ​   Returns an iterator over all elements in the directory at the specified path. Returns `nil` and an error messages if the path is invalid or some other error occurred.  ​