Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface API<OptionExtension>

Type parameters

  • OptionExtension = {}

Hierarchy

Index

Methods

  • Import a file or data into IPFS

    Parameters

    • entry: ImportCandidate
    • Optional options: AddOptions & OptionExtension

    Returns Promise<AddResult>

  • cat(ipfsPath: IPFSPath, options?: CatOptions & OptionExtension): AsyncIterable<Uint8Array>
  • Returns content of the file addressed by a valid IPFS Path or CID

    Parameters

    • ipfsPath: IPFSPath
    • Optional options: CatOptions & OptionExtension

    Returns AsyncIterable<Uint8Array>

  • commands(options?: AbortOptions & OptionExtension): Promise<string[]>
  • Returns a list of available commands

    Parameters

    Returns Promise<string[]>

  • dns(domain: string, options?: DNSOptions & OptionExtension): Promise<string>
  • Resolve DNS links

    Parameters

    • domain: string
    • Optional options: DNSOptions & OptionExtension

    Returns Promise<string>

  • get(ipfsPath: IPFSPath, options?: GetOptions & OptionExtension): AsyncIterable<Uint8Array>
  • Fetch a file or an entire directory tree from IPFS that is addressed by a valid IPFS Path

    Parameters

    • ipfsPath: IPFSPath
    • Optional options: GetOptions & OptionExtension

    Returns AsyncIterable<Uint8Array>

  • Returns the identity of the Peer

    example
    const identity = await ipfs.id()
    console.log(identity)

    Parameters

    • Optional options: IDOptions & OptionExtension

    Returns Promise<IDResult>

  • isOnline(): boolean
  • Returns true if this IPFS node is online - that is, it's listening on network addresses for incoming connections

    Returns boolean

  • Lists a directory from IPFS that is addressed by a valid IPFS Path

    Parameters

    • ipfsPath: IPFSPath
    • Optional options: ListOptions & OptionExtension

    Returns AsyncIterable<IPFSEntry>

  • Send echo request packets to IPFS hosts.

    example
    for await (const res of ipfs.ping('Qmhash')) {
    if (res.time) {
    console.log(`Pong received: time=${res.time} ms`)
    } else {
    console.log(res.text)
    }
    }

    Parameters

    • peerId: string
    • Optional options: PingOptions & OptionExtension

    Returns AsyncIterable<PingResult>

  • resolve(name: string, options?: ResolveOptions & OptionExtension): Promise<string>
  • Resolve the value of names to IPFS

    There are a number of mutable name protocols that can link among themselves and into IPNS. For example IPNS references can (currently) point at an IPFS object, and DNS links can point at other DNS links, IPNS entries, or IPFS objects. This command accepts any of these identifiers and resolves them to the referenced item.

    example
    // Resolve the value of your identity:
    const name = '/ipns/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy'

    const res = await ipfs.resolve(name)
    console.log(res)
    // Logs: /ipfs/Qmcqtw8FfrVSBaRmbWwHxt3AuySBhJLcvmFYi3Lbc4xnwj

    // Resolve the value of another name recursively:
    const name = '/ipns/QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n'

    // Where:
    // /ipns/QmbCMUZw6JFeZ7Wp9jkzbye3Fzp2GGcPgC3nmeUjfVF87n
    // ...resolves to:
    // /ipns/QmatmE9msSfkKxoffpHwNLNKgwZG8eT9Bud6YoPab52vpy
    // ...which in turn resolves to:
    // /ipfs/Qmcqtw8FfrVSBaRmbWwHxt3AuySBhJLcvmFYi3Lbc4xnwj

    const res = await ipfs.resolve(name, { recursive: true })
    console.log(res)
    // Logs: /ipfs/Qmcqtw8FfrVSBaRmbWwHxt3AuySBhJLcvmFYi3Lbc4xnwj

    // Resolve the value of an IPFS path:
    const name = '/ipfs/QmeZy1fGbwgVSrqbfh9fKQrAWgeyRnj7h8fsHS1oy3k99x/beep/boop'
    const res = await ipfs.resolve(name)
    console.log(res)
    // Logs: /ipfs/QmYRMjyvAiHKN9UTi8Bzt1HUspmSRD8T8DwxfSMzLgBon1

    Parameters

    Returns Promise<string>

  • start(): Promise<void>
  • Start the node

    Returns Promise<void>

  • stop(options?: AbortOptions & OptionExtension): Promise<void>
  • Stop the node

    Parameters

    Returns Promise<void>

  • Returns the implementation version

    example
    const version = await ipfs.version()
    console.log(version)

    Parameters

    Returns Promise<VersionResult>

Generated using TypeDoc