<commit_before>import ceylon.file {
    Path,
    File,
    parsePath
}
import ceylon.io {
    newOpenFile,
    OpenFile
}
import ceylon.io.buffer {
    ByteBuffer,
    newByteBuffer
}
import ceylon.net.http {
    contentType,
    contentLength
}
import ceylon.net.http.server {
    Response,
    Request,
    ServerException
}

"Endpoint for serving static files."
by("<NAME>")
shared void serveStaticFile(
                externalPath, 
                String fileMapper(Request request) => request.path,
                Options options = Options(),
                Anything(Request)? onSuccess = null,
                Anything(ServerException,Request)? onError = null)
        (Request request, Response response, void complete()) {
    
    "Root directory containing files."
    String externalPath;
    
    Path filePath = parsePath(externalPath + fileMapper(request));
    if (is File file = filePath.resource) {
        //TODO log
        //print("Serving file: ``filePath.absolutePath.string``");
        
        value openFile = newOpenFile(file);

        variable value available = file.size;<commit_msg>syntax disallowed by ceylon/ceylon-spec#1426<commit_after>import ceylon.file {
    Path,
    File,
    parsePath
}
import ceylon.io {
    newOpenFile,
    OpenFile
}
import ceylon.io.buffer {
    ByteBuffer,
    newByteBuffer
}
import ceylon.net.http {
    contentType,
    contentLength
}
import ceylon.net.http.server {
    Response,
    Request,
    ServerException
}

"Endpoint for serving static files."
by("<NAME>")
shared void serveStaticFile(
                "Root directory containing files."
                String externalPath, 
                String fileMapper(Request request) => request.path,
                Options options = Options(),
                Anything(Request)? onSuccess = null,
                Anything(ServerException,Request)? onError = null)
        (Request request, Response response, void complete()) {
    
    Path filePath = parsePath(externalPath + fileMapper(request));
    if (is File file = filePath.resource) {
        //TODO log
        //print("Serving file: ``filePath.absolutePath.string``");
        
        value openFile = newOpenFile(file);

        variable value available = file.size;
{'fraction_non_alphanumeric': 0.09574468085106383, 'fraction_numerical': 0.0017730496453900709, 'mean_word_length': 2.4405487804878048, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2495518', 'n_tokens_mistral': 628, 'n_tokens_neox': 599, 'n_words': 157}