Page
Library
Module
Module type
Parameter
Class
Class type
Source
Yocaml_unix
SourceA runtime describes the set of "low-level" primitives to operate in a specific context. This separation allows to have a pure and platform agnostic kernel (the Yocaml
module) and to define specific runtimes as needed. Here is the runtime for UNIXish (OSX/Linux).
Executes a YOCaml program using the UNIX Runtime.
serve ~filepath ~port engine
will serve, a bit like the sad python server, a static directory ... in addition, the function takes an OCaml program and re-executes it on every HTTP request that does not point to a 404. Very handy for continuous content development!
Inclusion of the runtime to be able to use Yocaml_unix
as runtime directly.
include Yocaml.Runtime.RUNTIME with type 'a t = 'a
file_exists path
should returns true
if path
exists (as a file or a directory), false
otherwise.
Same of file_exists
but acting on the target.
is_directory path
should returns true
if path
is an existing file and if the file is a directory, false
otherwise.
get_modification_time path
should returns a Try.t
containing the modification time (as an integer) of the given file. The function may fail.
Same of get_modification_time
but acting on the target.
read_file path
should returns a Try.t
containing the content (as a string) of the given file. The function may fail.
content_changes filepath new_content
check if the content of the file has been changed.
write_file path content
should write (create or overwrite) content
into the given path. The function may fail.
read_dir path
should returns a list of children. The function is pretty optimistic if the directory does not exist, or for any other possible reason the function should fail, it will return an empty list.
create_dir path
is an optimistic version of mkdir -p
, the function extract the directory of a file and create it if it does not exists without any failure.
log level message
justs dump a message on stdout.