Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface API<OptionExtension>

Type parameters

  • OptionExtension = {}

Hierarchy

  • API

Index

Properties

Methods

Properties

pubsub: API<{}>

Methods

  • IPNS is a PKI namespace, where names are the hashes of public keys, and the private key enables publishing new (signed) values. In both publish and resolve, the default name used is the node's own PeerID, which is the hash of its public key.

    example
    // The address of your files.
    const addr = '/ipfs/QmbezGequPwcsWo8UL4wDF6a8hYwM1hmbzYv2mnKkEWaUp'
    const res = await ipfs.name.publish(addr)
    // You now have a res which contains two fields:
    // - name: the name under which the content was published.
    // - value: the "real" address to which Name points.
    console.log(`https://gateway.ipfs.io/ipns/${res.name}`)

    Parameters

    Returns Promise<PublishResult>

  • resolve(value: string, options?: ResolveOptions & OptionExtension): AsyncIterable<string>
  • Given a key, query the DHT for its best value.

    example
    // The IPNS address you want to resolve
    const addr = '/ipns/ipfs.io'

    for await (const name of ipfs.name.resolve(addr)) {
    console.log(name)
    }
    // Logs: /ipfs/QmQrX8hka2BtNHa8N8arAq16TCVx5qHcb46c5yPewRycLm

    Parameters

    Returns AsyncIterable<string>

Generated using TypeDoc