How to use the ipfs-repo.errors function in ipfs-repo

To help you get started, we’ve selected a few ipfs-repo 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 / boot.js View on Github external
'use strict'

const RepoErrors = require('ipfs-repo').errors

// Boot an IPFS node depending on the options set
module.exports = async (self) => {
  self.log('booting')
  const options = self._options
  const doInit = options.init
  const doStart = options.start

  // Checks if a repo exists, and if so opens it
  // Will return callback with a bool indicating the existence
  // of the repo
  async function repoOpened () {
    // nothing to do
    if (!self._repo.closed) {
      return true
    }
github ipfs / js-ipfs / src / core / components-ipfsx / init.js View on Github external
const NoKeychain = require('../components/no-keychain')
const GCLock = require('../components/pin/gc-lock')
const { DAGNode } = require('ipld-dag-pb')
const UnixFs = require('ipfs-unixfs')
const multicodec = require('multicodec')
const multiaddr = require('multiaddr')
const {
  AlreadyInitializingError,
  AlreadyInitializedError,
  NotStartedError
} = require('../../errors')
const BlockService = require('ipfs-block-service')
const Ipld = require('ipld')
const getDefaultIpldOptions = require('../runtime/ipld-nodejs')
const createPreloader = require('./preload')
const { ERR_REPO_NOT_INITIALIZED } = require('ipfs-repo').errors
const IPNS = require('../ipns')
const OfflineDatastore = require('../ipns/routing/offline-datastore')
const initAssets = require('../runtime/init-assets-nodejs')
const Components = require('.')
const PinManager = require('../components/pin/pin-manager')

module.exports = ({
  apiManager,
  print,
  constructorOptions
}) => async function init (options) {
  const { cancel } = apiManager.update({ init: () => { throw new AlreadyInitializingError() } })

  try {
    options = mergeOptions({}, options, constructorOptions.init)

ipfs-repo

IPFS Repo implementation

Apache-2.0 OR MIT
Latest version published 2 years ago

Package Health Score

54 / 100
Full package analysis