ipfs-http-client
Version:
A client library for the IPFS HTTP API
19 lines • 544 B
JavaScript
import { configure } from '../lib/configure.js';
import { toUrlSearchParams } from '../lib/to-url-search-params.js';
export const createResolve = configure(api => {
async function* resolve(path, options = {}) {
const res = await api.post('name/resolve', {
signal: options.signal,
searchParams: toUrlSearchParams({
arg: path,
stream: true,
...options
}),
headers: options.headers
});
for await (const result of res.ndjson()) {
yield result.Path;
}
}
return resolve;
});