ipfs-http-client
Version:
A client library for the IPFS HTTP API
20 lines • 558 B
JavaScript
import { configure } from '../lib/configure.js';
import { toUrlSearchParams } from '../lib/to-url-search-params.js';
export const createGet = configure(api => {
const get = async (key, options = {}) => {
if (!key) {
throw new Error('key argument is required');
}
const res = await api.post('config', {
signal: options.signal,
searchParams: toUrlSearchParams({
arg: key,
...options
}),
headers: options.headers
});
const data = await res.json();
return data.Value;
};
return get;
});