How to use callbackify - 10 common examples

To help you get started, we’ve selected a few callbackify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ipfs / js-ipfs / src / core / components / config.js View on Github external
module.exports = function config (self) {
  return {
    get: callbackify.variadic(self._repo.config.get),
    set: callbackify(self._repo.config.set),
    replace: callbackify.variadic(self._repo.config.set),
    profiles: {
      apply: callbackify.variadic(applyProfile),
      list: callbackify.variadic(listProfiles)
    }
  }

  async function applyProfile (profileName, opts) {
    opts = opts || {}
    const { dryRun } = opts

    const profile = profiles[profileName]

    if (!profile) {
      throw new Error(`No profile with name '${profileName}' exists`)
    }

    try {
      const oldCfg = await self.config.get()
      let newCfg = JSON.parse(JSON.stringify(oldCfg)) // clone
github ipfs / js-ipfs / src / core / components / files-regular / refs.js View on Github external
module.exports = function (self) {
  return callbackify.variadic(async function refs (ipfsPath, options) { // eslint-disable-line require-await
    return all(self._refsAsyncIterator(ipfsPath, options))
  })
}
github ipfs / js-ipfs-http-client / src / object / index.js View on Github external
module.exports = config => ({
  data: callbackify.variadic(concatify(require('./data')(config))),
  get: callbackify.variadic(require('./get')(config)),
  links: callbackify.variadic(require('./links')(config)),
  new: callbackify.variadic(require('./new')(config)),
  patch: require('./patch')(config),
  put: callbackify.variadic(require('./put')(config)),
  stat: callbackify.variadic(require('./stat')(config))
})
github ipfs / js-ipfs-http-client / src / repo / index.js View on Github external
module.exports = config => ({
  gc: callbackify.variadic(collectify(require('./gc')(config))),
  stat: callbackify.variadic(require('./stat')(config)),
  version: callbackify.variadic(require('./version')(config))
})
github ipfs / js-ipfs-http-client / src / bitswap / index.js View on Github external
module.exports = (config) => ({
  wantlist: callbackify.variadic(require('./wantlist')(config)),
  stat: callbackify.variadic(require('./stat')(config)),
  unwant: callbackify.variadic(require('./unwant')(config))
})
github ipfs / js-ipfs-http-client / src / files / index.js View on Github external
module.exports = config => {
  const ls = require('./ls')(config)
  const read = require('./read')(config)

  return {
    cp: callbackify.variadic(require('./cp')(config)),
    mkdir: callbackify.variadic(require('./mkdir')(config)),
    flush: callbackify.variadic(require('./flush')(config)),
    stat: callbackify.variadic(require('./stat')(config)),
    rm: callbackify.variadic(require('./rm')(config)),
    ls: callbackify.variadic(collectify(ls)),
    lsReadableStream: streamify.readable(ls),
    lsPullStream: pullify.source(ls),
    read: callbackify.variadic(concatify(read)),
    readReadableStream: streamify.readable(read),
    readPullStream: pullify.source(read),
    write: callbackify.variadic(require('./write')(config)),
    mv: callbackify.variadic(require('./mv')(config))
  }
}
github ipfs / js-ipfs-http-client / src / block / index.js View on Github external
module.exports = config => {
  const rm = require('./rm-async-iterator')(config)

  return {
    get: callbackify.variadic(require('./get')(config)),
    stat: callbackify.variadic(require('./stat')(config)),
    put: callbackify.variadic(require('./put')(config)),
    rm: (input, options, callback) => {
      if (typeof options === 'function') {
        callback = options
        options = {}
      }
      return nodeify(collectify(rm)(input, options), callback)
    },
    _rmAsyncIterator: rm
  }
}
github ipfs / js-ipfs-http-client / src / log / index.js View on Github external
module.exports = config => ({
  tail: require('./tail')(config),
  ls: callbackify.variadic(require('./ls')(config)),
  level: callbackify.variadic(require('./level')(config))
})
github ipfs / js-ipfs-http-client / src / pin / index.js View on Github external
module.exports = config => ({
  add: callbackify.variadic(require('./add')(config)),
  rm: callbackify.variadic(require('./rm')(config)),
  ls: callbackify.variadic(require('./ls')(config))
})
github ipfs / js-ipfs-http-client / src / bootstrap / index.js View on Github external
module.exports = config => ({
  add: callbackify.variadic(require('./add')(config)),
  rm: callbackify.variadic(require('./rm')(config)),
  list: callbackify.variadic(require('./list')(config))
})

callbackify

backwards compatibilify your callback functions while migrating apis to promises

MIT
Latest version published 10 years ago

Package Health Score

42 / 100
Full package analysis

Popular callbackify functions