← FileHeron

Documentation

Everything FileHeron does, and the exact commands to do it with. Written against fileheron_server 1.0.5.

Add the package, describe the server, start it.

Published on pub.dev under the verified horizech.com publisher, MIT licensed.

add the dependency
$ dart pub add fileheron_server
bin/serve.dart
import 'package:fileheron_server/fileheron_server.dart';
void main() {
final server = FileHeronServer();
server.initStaticServer(ServerParams(
hostname: 'localhost',
port: 8080,
root: 'public',
logFile: 'log.txt',
));
server.start();
}

The whole public API is those two names: FileHeronServer and ServerParams. Call stop() to shut it down.

Compile once, then it is just a binary.

There are no prebuilt downloads yet — you build it yourself, which takes one command and produces a native executable with no runtime to install alongside it.

build and run
$ git clone https://github.com/horizech/fileheron_cli
$ cd fileheron_cli && dart pub get
$ dart compile exe bin/main.dart -o build/fileheron
# macOS/Linux: make it executable if it is not already
$ chmod 755 build/fileheron
$ ./build/fileheron -p 8080 -r ./dist -l log.txt
Serving ./dist at http://localhost:8080

On Windows the compile step uses backslashes:

windows
> dart compile exe bin\main.dart -o build\fileheron.exe

Every flag, with its real default.

⚠️ These are all options rather than switches, so the boolean ones need an explicit value — -d true, not a bare -d. There is no --help.

-h, --hostAddress to bind tolocalhost
-p, --portPort to listen on80
-r, --rootFolder to servepublic
-l, --logFileAppend each request to this file
-d, --listDirPrint each request to the consoletrue
-s, --sslServe over HTTPS (see the note below)false
-c, --certificateChainCertificate chain file
-k, --serverKeyPrivate key file
-u, --serverKeyPasswordPassword for the private key
  • The port default is 80, which on macOS and Linux needs elevated privileges — pass -p 8080 unless you mean it.
  • Pass -l a log file. The option has no default value, and the argument parser reads it into a non-nullable string, so omitting it is not currently safe. Every example here includes it deliberately.
  • -d is console output, not a file browser. It prints each request as it is served. Directories always resolve to their index.html.
  • HTTPS is unfinished. The certificate options exist and the package documents the feature as not yet working, so put a real proxy in front of it if you need TLS rather than relying on -s true.

What it needs.

Dart SDK
As declared by the package
>=2.17.3 <3.0.0
Platforms
Anywhere the Dart VM runs
Windows · macOS · Linux
Licence
Library and command line tool
MIT
Latest release
Published 30 August 2022
1.0.5

The SDK constraint predates Dart 3. If you are on a newer SDK and the resolver objects, that constraint is the reason — the repository is the place to raise it.