# All files / src/server pin.js

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

    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

    23x

    2x

    2x

    6x

     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)
      }
    }