cnp/0.4 contnet.org/util/cn-fileserver/ cnp/0.4 ok length=1866 modified=2021-03-04T17:26:30Z name=index.cnm time=2024-04-23T22:17:03Z type=text/cnm title util/cn-fileserver content text fmt **cn-fileserver** serves files from a directory over CNP. It can also list directory contents as a CNM document. section Installation text fmt cn-fileserver requires @@https://golang.org/dl/ Go 1.8 or later@@. Install it with: raw sh go install contnet.org/util/cn-fileserver@latest section Usage text fmt Run it with ``cn-fileserver [OPTIONS]`` Available options: list text fmt ``-dir DIR``: serve files from folder DIR (default ``.``) text fmt ``-listen HOST:PORT``: listen on HOST:PORT (default ``localhost:25454``; port is optional and defaults to 25454) text fmt ``-select SELECTORS``: comma-separated list of enabled selectors (default ``byte,info,cnm`` enables all selectors; ``-select=`` to disable selectors) text fmt File matching rules: list text fmt If the requested path doesn't end with ``/`` but is a folder, it will be redirected to the same path with a slash appended. text fmt If the requested path is a folder that contains a file named ``index.cnm``, that file will be sent as the response. text fmt If the requested path is a file, the file will be sent as the response. text fmt If the requested path with ``.cnm`` appended is a file, that file will be sent as the response. text fmt Otherwise the requested path does not exist and an ``error`` response is sent. text fmt For example: ``cn-fileserver -listen 0.0.0.0 -dir /var/contnet/cnroot`` A sample systemd service unit file is also provided with the source code. section Source text fmt The cn-fileserver source code is available on @@https://git.clsr.net/contnet/cn-fileserver@@ links /spec/ Specifications /doc/ Documents /draft/ Drafts /lib/ Libraries /util/ Tools and utilities site tool cn-fileserver