How to use the ipfsd-ctl.create function in ipfsd-ctl

To help you get started, we’ve selected a few ipfsd-ctl 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 / test / utils / interface-common-factory.js View on Github external
const setup = async (setupOptions = {}) => {
      options.factoryOptions = mergeOptions(
        options.factoryOptions ? {} : { ...DEFAULT_FACTORY_OPTIONS },
        setupOptions.factoryOptions,
        options.factoryOptions
      )

      // When not an in proc daemon use the http-client js-ipfs depends on, not the one from ipfsd-ctl
      if (options.factoryOptions.type !== 'proc') {
        options.factoryOptions.IpfsClient = options.factoryOptions.IpfsClient || ipfsClient
      }

      const ipfsFactory = IPFSFactory.create(options.factoryOptions)

      options.spawnOptions = mergeOptions(
        {
          config: {
            Bootstrap: [],
            Discovery: {
              MDNS: {
                Enabled: false
              },
              webRTCStar: {
                Enabled: false
              }
            }
          },
          preload: { enabled: false }
        },
github ipfs / js-ipfs / test / http-api / version.js View on Github external
/* eslint-env mocha */
'use strict'

const chai = require('chai')
const dirtyChai = require('dirty-chai')
const expect = chai.expect
chai.use(dirtyChai)
const path = require('path')
const DaemonFactory = require('ipfsd-ctl')
const df = DaemonFactory.create({ exec: path.resolve(`${__dirname}/../../src/cli/bin.js`) })

describe('version endpoint', () => {
  let ipfs = null
  let ipfsd = null
  before(function (done) {
    this.timeout(20 * 1000)
    df.spawn({
      initOptions: { bits: 512 },
      config: {
        Bootstrap: [],
        Discovery: {
          MDNS: {
            Enabled: false
          },
          webRTCStar: {
            Enabled: false
github ipfs / js-ipfs / test / core / interface / object.js View on Github external
/* eslint-env mocha */
'use strict'

const test = require('interface-ipfs-core')
const parallel = require('async/parallel')

const IPFS = require('../../../src')

const DaemonFactory = require('ipfsd-ctl')
const df = DaemonFactory.create({ type: 'proc', exec: IPFS })

const nodes = []
const common = {
  setup: function (callback) {
    callback(null, {
      spawnNode: (cb) => {
        df.spawn({
          initOptions: { bits: 512 }
        }, (err, _ipfsd) => {
          if (err) {
            return cb(err)
          }

          nodes.push(_ipfsd)
          cb(null, _ipfsd.api)
        })
github ipfs / js-ipfs / test / http-api / interface / config.js View on Github external
/* eslint-env mocha */
'use strict'

const test = require('interface-ipfs-core')
const parallel = require('async/parallel')

const DaemonFactory = require('ipfsd-ctl')
const df = DaemonFactory.create({ exec: 'src/cli/bin.js' })

const nodes = []
const common = {
  setup: function (callback) {
    callback(null, {
      spawnNode: (cb) => {
        df.spawn({
          initOptions: { bits: 512 }
        }, (err, _ipfsd) => {
          if (err) {
            return cb(err)
          }

          nodes.push(_ipfsd)
          cb(null, _ipfsd.api)
        })
github ipfs / js-ipfs / test / core / interface / swarm.js View on Github external
/* eslint-env mocha */
'use strict'

const test = require('interface-ipfs-core')
const parallel = require('async/parallel')

const IPFS = require('../../../src')

const DaemonFactory = require('ipfsd-ctl')
const df = DaemonFactory.create({ type: 'proc', exec: IPFS })

const nodes = []
const common = {
  setup: function (callback) {
    callback(null, {
      spawnNode: (repoPath, config, cb) => {
        if (typeof repoPath === 'function') {
          cb = repoPath
          repoPath = undefined
        }

        if (typeof config === 'function') {
          cb = config
          config = undefined
        }
github ipfs / js-ipfs / test / http-api / interface / pubsub.js View on Github external
/* eslint-env mocha */
'use strict'

const test = require('interface-ipfs-core')
const parallel = require('async/parallel')

const DaemonFactory = require('ipfsd-ctl')
const df = DaemonFactory.create({ exec: 'src/cli/bin.js' })

const nodes = []
const common = {
  setup: function (callback) {
    callback(null, {
      spawnNode: (cb) => {
        df.spawn({
          args: ['--enable-pubsub-experiment'],
          initOptions: { bits: 512 }
        }, (err, _ipfsd) => {
          if (err) {
            return cb(err)
          }

          nodes.push(_ipfsd)
          cb(null, _ipfsd.api)
github ipfs / js-ipfs / test / core / interface / stats.js View on Github external
/* eslint-env mocha */
'use strict'

const test = require('interface-ipfs-core')
const parallel = require('async/parallel')

const IPFS = require('../../../src')

const DaemonFactory = require('ipfsd-ctl')
const df = DaemonFactory.create({ type: 'proc', exec: IPFS })

const nodes = []
const common = {
  setup: function (callback) {
    callback(null, {
      spawnNode: (cb) => {
        df.spawn({
          initOptions: { bits: 512 }
        }, (err, _ipfsd) => {
          if (err) {
            return cb(err)
          }

          nodes.push(_ipfsd)
          cb(null, _ipfsd.api)
        })
github ipfs-shipyard / js-ipfs-http-client-lite / test / utils / interface-common-factory.js View on Github external
function createFactory (options) {
  options = options || {}

  options.factoryOptions = options.factoryOptions || {}
  options.spawnOptions = options.spawnOptions || { initOptions: { bits: 1024, profile: 'test' } }

  const ipfsFactory = IPFSFactory.create(options.factoryOptions)

  return function createCommon () {
    const nodes = []
    let setup, teardown

    if (options.createSetup) {
      setup = options.createSetup({ ipfsFactory, nodes }, options)
    } else {
      setup = (callback) => {
        callback(null, {
          spawnNode (repoPath, config, cb) {
            if (typeof repoPath === 'function') {
              cb = repoPath
              repoPath = null
            }
github IPSE-TEAM / ipse-desktop / src / daemon / daemon.js View on Github external
async function spawn ({ type, path, keysize }) {
  const factory = IPFSFactory.create({ type: type })

  const ipfsd = await factory.spawn({
    disposable: false,
    defaultAddrs: true,
    repoPath: path,
    init: false,
    start: false
  })

  if (ipfsd.initialized) {
    checkCorsConfig(ipfsd)
    addPeerIdsToConfig(ipfsd)
    return ipfsd
  }

  await ipfsd.init({
github Konjure / konjure-desktop-app / app / views / main / ipfs / IPFSDaemon.js View on Github external
constructor() {
    super();

    this.factory = IPFSFactory.create({
      type: 'proc',
      exec: IPFS,
      port: 5001
    });

    this.start = this.start.bind(this);
    this.running = this.running.bind(this);
    this.getAPI = this.getAPI.bind(this);

    this.ipfsd = null;
  }