ipfs-http-client
Version:
A client library for the IPFS HTTP API
20 lines • 597 B
JavaScript
import { objectToCamel } from '../lib/object-to-camel.js';
import { configure } from '../lib/configure.js';
import { toUrlSearchParams } from '../lib/to-url-search-params.js';
export const createRename = configure(api => {
async function rename(oldName, newName, options = {}) {
const res = await api.post('key/rename', {
signal: options.signal,
searchParams: toUrlSearchParams({
arg: [
oldName,
newName
],
...options
}),
headers: options.headers
});
return objectToCamel(await res.json());
}
return rename;
});