# All files / server pin.js

50% Statements 4/8
100% Branches 0/0
0% Functions 0/3
50% Lines 4/8

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
    281x
    1x
    1x
    1x

     import { expose } from 'postmsg-rpc'
    import { pre } from 'prepost'
    import { preCidFromJson } from '../serialization/cid'
    import { preBufferFromJson } from '../serialization/buffer'

    export default function (getIpfs, opts) {
      return {
        add: expose('ipfs.pin.add', pre(
          preBufferFromJson(0),
          preCidFromJson(0),
          opts.pre('pin.add'),
          (...args) => getIpfs().pin.add(...args)
        ), opts),
        rm: expose('ipfs.pin.rm', pre(
          preBufferFromJson(0),
          preCidFromJson(0),
          opts.pre('pin.rm'),
          (...args) => getIpfs().pin.rm(...args)
        ), opts),
        ls: expose('ipfs.pin.ls', pre(
          preBufferFromJson(0),
          preCidFromJson(0),
          opts.pre('pin.ls'),
          (...args) => getIpfs().pin.ls(...args)
        ), opts)
      }
    }