UNPKG

@naria2/node

Version:

Cross-platform wrapper of aria2

36 lines (33 loc) 1.4 kB
import * as http from 'http'; import { IncomingMessage, ServerResponse } from 'node:http'; import { b as ChildProcessSocket } from './shared/node.b405a139.cjs'; import 'node:child_process'; import 'maria2'; import 'type-fest'; import 'maria2/transport'; import '@naria2/options'; interface WebUIOptions { host?: string; port?: number; rpc: { port: number; secret: string | undefined; }; } declare function launchWebUI(options: WebUIOptions): Promise<{ server: http.Server<typeof IncomingMessage, typeof ServerResponse>; host: string | undefined; port: number; url: string; }>; type MaybePromise<T> = T | Promise<T>; declare function attachWebUI(_socket: MaybePromise<ChildProcessSocket>, options?: Pick<WebUIOptions, 'host' | 'port'>): Promise<{ socket: ChildProcessSocket; server: http.Server<typeof IncomingMessage, typeof ServerResponse>; host: string | undefined; port: number; url: string; }>; declare function createWebUIHandler(options: Pick<WebUIOptions, 'rpc'>): Promise<(req: IncomingMessage, res: ServerResponse<IncomingMessage>) => Promise<boolean>>; declare function handleWebUIOpenRequest(url: URL, req: IncomingMessage, res: ServerResponse<IncomingMessage>, options: Pick<WebUIOptions, 'rpc'>): Promise<boolean>; export { type WebUIOptions, attachWebUI, createWebUIHandler, handleWebUIOpenRequest, launchWebUI };