All files / client repo.js

38.46% Statements 5/13
0% Branches 0/8
0% Functions 0/1
38.46% Lines 5/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 341x 1x 1x 1x     39x                                                      
import { caller } from 'postmsg-rpc'
import callbackify from 'callbackify'
import { post } from 'prepost'
import { isBigJson, bigFromJson } from '../serialization/big'
 
export default function (opts) {
  return {
    gc: callbackify.variadic(caller('ipfs.repo.gc', opts)),
    stat: callbackify.variadic(
      post(
        caller('ipfs.repo.stat', opts),
        (stats) => {
          if (stats) {
            if (isBigJson(stats.numObjects)) {
              stats.numObjects = bigFromJson(stats.numObjects)
            }
 
            if (isBigJson(stats.repoSize)) {
              stats.repoSize = bigFromJson(stats.repoSize)
            }
 
            if (isBigJson(stats.storageMax)) {
              stats.storageMax = bigFromJson(stats.storageMax)
            }
          }
 
          return stats
        }
      )
    ),
    version: callbackify(caller('ipfs.repo.version', opts))
  }
}