ipfs-http-client
Version:
A client library for the IPFS HTTP API
16 lines • 565 B
JavaScript
import { toUrlSearchParams } from '../../../lib/to-url-search-params.js';
import { decodeRemoteService } from './utils.js';
export function createLs(client) {
async function ls(options = {}) {
const {stat, headers, timeout, signal} = options;
const response = await client.post('pin/remote/service/ls', {
timeout,
signal,
headers,
searchParams: stat === true ? toUrlSearchParams({ stat }) : undefined
});
const {RemoteServices} = await response.json();
return RemoteServices.map(decodeRemoteService);
}
return ls;
}