ipfs-http-client
Version:
A client library for the IPFS HTTP API
28 lines (23 loc) • 758 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var configure = require('../lib/configure.js');
var toUrlSearchParams = require('../lib/to-url-search-params.js');
const createStat = configure.configure(api => {
async function stat(options = {}) {
const res = await api.post('repo/stat', {
signal: options.signal,
searchParams: toUrlSearchParams.toUrlSearchParams(options),
headers: options.headers
});
const data = await res.json();
return {
numObjects: BigInt(data.NumObjects),
repoSize: BigInt(data.RepoSize),
repoPath: data.RepoPath,
version: data.Version,
storageMax: BigInt(data.StorageMax)
};
}
return stat;
});
exports.createStat = createStat;