All files / client index.js

100% Statements 27/27
100% Branches 0/0
100% Functions 0/0
100% Lines 27/27

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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 601x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x     39x                                             39x             39x 39x 39x 39x 39x   39x    
import { caller } from 'postmsg-rpc'
import callbackify from 'callbackify'
import createBitswap from './bitswap'
import createBlock from './block'
import createBootstrap from './bootstrap'
import createConfig from './config'
import createDag from './dag'
import createDht from './dht'
import createFiles from './files'
import createKey from './key'
import createLs from './ls'
import createName from './name'
import createObject from './object'
import createPin from './pin'
import createPing from './ping'
import createPubsub from './pubsub'
import createRepo from './repo'
import createStats from './stats'
import createSwarm from './swarm'
 
export default (opts) => {
  const ipfs = {
    bitswap: createBitswap(opts),
    block: createBlock(opts),
    bootstrap: createBootstrap(opts),
    config: createConfig(opts),
    dag: createDag(opts),
    dht: createDht(opts),
    dns: callbackify.variadic(caller('ipfs.dns', opts)),
    files: createFiles(opts),
    id: callbackify(caller('ipfs.id', opts)),
    key: createKey(opts),
    name: createName(opts),
    object: createObject(opts),
    pin: createPin(opts),
    pubsub: createPubsub(opts),
    repo: createRepo(opts),
    resolve: callbackify.variadic(caller('ipfs.resolve', opts)),
    stats: createStats(opts),
    stop: callbackify(caller('ipfs.stop', opts)),
    swarm: createSwarm(opts),
    version: callbackify(caller('ipfs.version', opts))
  }
 
  Object.assign(
    ipfs,
    createLs(opts),
    createPing(opts)
  )
 
  // Aliases
  ipfs.add = ipfs.files.add
  ipfs.get = ipfs.files.get
  ipfs.cat = ipfs.files.cat
  ipfs.stats.bitswap = ipfs.bitswap.stat
  ipfs.stats.repo = ipfs.repo.stat
 
  return ipfs
}