UNPKG

kubo-rpc-client

Version:
16 lines (13 loc) 480 B
import { toUrlSearchParams } from './lib/to-url-search-params.js' import type { KuboRPCClient } from './index.js' import type { HTTPRPCClient } from './lib/core.js' export function createStop (client: HTTPRPCClient): KuboRPCClient['stop'] { return async function stop (options = {}) { const res = await client.post('shutdown', { signal: options.signal, searchParams: toUrlSearchParams(options), headers: options.headers }) await res.text() } }