hostlocal - v2.1.3
    Preparing search index...

    Interface HostOptions

    interface HostOptions {
        caDir?: string;
        caSubject?: string;
        certDir?: string;
        CGI?: { [contentType: string]: string };
        config?: null | string;
        dir?: string;
        exec?: string;
        forceCA?: boolean;
        forceCert?: boolean;
        glob?: null | string[];
        headers?: OutgoingHttpHeaders;
        host?: string;
        index?: string[];
        initial?: boolean;
        ipv6?: boolean;
        log?: null | Logger;
        logFile?: null | string;
        logLevel?: number;
        minRunDays?: number;
        noKey?: boolean;
        notAfterDays?: number;
        open?: string | boolean;
        openFn?: (target: string, options?: Options) => Promise<ChildProcess>;
        port?: number;
        prefix?: string;
        rawMarkdown?: boolean;
        script?: boolean;
        shutTimes?: number;
        signal?: null | AbortSignal;
        timeout?: null | number;
    }

    Hierarchy (View Summary)

    Index

    Properties

    caDir?: string

    Relative to cwd.

    caSubject?: string

    Subject Distinguished Name for CA.

    certDir?: string

    Relative to cwd.

    CGI?: { [contentType: string]: string }

    Pass files of these MIME types to a CGI handler on the command line.

    config?: null | string

    Config file name.

    dir?: string

    Directory to serve.

    exec?: string

    Command to execute when watch glob matches.

    forceCA?: boolean

    Always create a new CA cert, even if one exists and is valid.

    forceCert?: boolean

    Always create a new certificate, even if one exists and is valid.

    glob?: null | string[]

    Watch this glob. When it changes, execute the exec command.

    headers?: OutgoingHttpHeaders

    Extra headers to add to every response.

    host?: string

    Hostname or IP address to listen on. "::" for everything.

    index?: string[]

    List of files to try in order if a directory is specified as URL.

    initial?: boolean

    If glob is specified, run the exec command on startup as well as on file change.

    ipv6?: boolean

    Listen on IPv6 only, if host supports both IPv4 and IPv6.

    log?: null | Logger

    Already have a log file?

    logFile?: null | string

    Log to a file instead.

    logLevel?: number

    0 for info. +verbose, -quiet.

    minRunDays?: number

    Minimum number of days the serve can run. Ensure the cert will good at least this long.

    noKey?: boolean

    If true, do not read the key.

    notAfterDays?: number

    Certificate invalid after this many days, server restart required.

    open?: string | boolean

    Path to open.

    openFn?: (target: string, options?: Options) => Promise<ChildProcess>

    For testing only.

    Type declaration

      • (target: string, options?: Options): Promise<ChildProcess>
      • Open stuff like URLs, files, executables. Cross-platform.

        Uses the command open on macOS, start on Windows and xdg-open on other platforms.

        There is a caveat for double-quotes on Windows where all double-quotes are stripped from the target.

        Parameters

        • target: string

          The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. For example, URLs open in your default browser.

        • Optionaloptions: Options

        Returns Promise<ChildProcess>

        The spawned child process. You would normally not need to use this for anything, but it can be useful if you'd like to attach custom event listeners or perform other operations directly on the spawned process.

        import open, {apps} from 'open';

        // Opens the image in the default image viewer.
        await open('unicorn.png', {wait: true});
        console.log('The image viewer app quit');

        // Opens the URL in the default browser.
        await open('https://sindresorhus.com');

        // Opens the URL in a specified browser.
        await open('https://sindresorhus.com', {app: {name: 'firefox'}});

        // Specify app arguments.
        await open('https://sindresorhus.com', {app: {name: 'google chrome', arguments: ['--incognito']}});

        // Opens the URL in the default browser in incognito mode.
        await open('https://sindresorhus.com', {app: {name: apps.browserPrivate}});
    port?: number

    TCP Port to listen on.

    prefix?: string

    Make all of the URLs served have paths that start with this prefix, followed by a slash.

    rawMarkdown?: boolean

    If true, do not process markdown to HTML.

    script?: boolean

    If true, append script to HTML to cause automatic refreshes.

    shutTimes?: number

    Shut down the server when we are asked this many times.

    signal?: null | AbortSignal

    Abort this to stop the server.

    timeout?: null | number

    Time, in ms, to let glob commands run before termination.