Module moonwalk.drive
Filesystem utilities.
Used by the standalone servers server.socket and server.luanode .
Might also be useful within an operation. The mimetypes and lfs
modules are highly recommended, although this may work without them.
Functions
| guess_mime_type (path) | Guess a file's MIME type. |
| is_directory (path) | Determine if path is a directory. |
| last_modified (path) | Get file's last modified date. |
| path_exists (path) | Determine if path (file or directory) exists. |
| run_script (path, hostdata) | Run a Lua script given a filename. |
Functions
- guess_mime_type (path)
-
Guess a file's MIME type.
Parameters:
- path Absolute or relative file path.
Returns:
-
The MIME type string, or
nilif unable to guess a type. - is_directory (path)
-
Determine if path is a directory.
Parameters:
- path Absolute or relative file path.
Returns:
trueif the path is a directory, elsefalse. - last_modified (path)
-
Get file's last modified date.
May return
nilif unable to get a timestamp.Parameters:
- path Absolute or relative file path.
Returns:
-
Timestamp representing the last modification time.
- path_exists (path)
-
Determine if path (file or directory) exists.
.
Parameters:
- path Absolute or relative file path.
Returns:
trueif the path exists, elsefalse - run_script (path, hostdata)
-
Run a Lua script given a filename.
This is used to pass arbitrary data (
hostdata) to the file so that it is available to the connection .Parameters:
- path Absolute or relative file path.
- hostdata Data the host can use later, sent through varargs.
Returns:
-
The result of running the file.