helia
    Preparing search index...

    Function libp2pDefaults

    • Returns the default libp2p config used by Helia which can then be modified or extended to suit individual applications.

      Returns DefaultLibp2pOptions

      import { myService } from '@example/my-service'
      import { createHelia } from 'helia'
      import { libp2pDefaults } from '@helia/libp2p'

      // get a copy of the default libp2p config
      const libp2p = libp2pDefaults()

      // add the custom service to the service map
      libp2p.services.myService = myService()

      // create a Helia node with the custom libp2p config
      const helia = await createHelia({
      libp2p
      })

      //... use service
      helia.libp2p.services.myService.serviceMethod()
    • Returns the default libp2p config used by Helia which can then be modified or extended to suit individual applications.

      Type Parameters

      Parameters

      Returns Libp2pInit<DefaultLibp2pServices> & { start?: boolean } & Required<
          Pick<
              Libp2pOptions<DefaultLibp2pServices>,

                  | "nodeInfo"
                  | "addresses"
                  | "transports"
                  | "connectionEncrypters"
                  | "streamMuxers"
                  | "peerDiscovery"
                  | "services",
          >,
      > & Options

      import { myService } from '@example/my-service'
      import { createHelia } from 'helia'
      import { libp2pDefaults } from '@helia/libp2p'

      // get a copy of the default libp2p config
      const libp2p = libp2pDefaults()

      // add the custom service to the service map
      libp2p.services.myService = myService()

      // create a Helia node with the custom libp2p config
      const helia = await createHelia({
      libp2p
      })

      //... use service
      helia.libp2p.services.myService.serviceMethod()