Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface API<OptionExtension>

Type parameters

  • OptionExtension = {}

Hierarchy

  • API

Index

Properties

Methods

Properties

remote: API<OptionExtension>

Methods

  • add(cid: string | CID, options?: AddOptions & OptionExtension): Promise<CID>
  • Adds an IPFS block to the pinset and also stores it to the IPFS repo. pinset is the set of hashes currently pinned (not gc'able)

    example
    const cid = CID.parse('QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u')
    const pinned of ipfs.pin.add(cid))
    console.log(pinned)
    // Logs:
    // CID('QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u')

    Parameters

    • cid: string | CID
    • Optional options: AddOptions & OptionExtension

    Returns Promise<CID>

  • Adds multiple IPFS blocks to the pinset and also stores it to the IPFS repo. pinset is the set of hashes currently pinned (not gc'able)

    example
    const cid = CID.parse('QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u')
    for await (const cid of ipfs.pin.addAll([cid])) {
    console.log(cid)
    }
    // Logs:
    // CID('QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u')

    Parameters

    Returns AsyncIterable<CID>

  • List all the objects pinned to local storage

    example
    for await (const { cid, type } of ipfs.pin.ls()) {
    console.log({ cid, type })
    }
    // { cid: CID(Qmc5XkteJdb337s7VwFBAGtiaoj2QCEzyxtNRy3iMudc3E), type: 'recursive' }
    // { cid: CID(QmZbj5ruYneZb8FuR9wnLqJCpCXMQudhSdWhdhp5U1oPWJ), type: 'indirect' }
    // { cid: CID(QmSo73bmN47gBxMNqbdV6rZ4KJiqaArqJ1nu5TvFhqqj1R), type: 'indirect' }

    const paths = [
    CID.parse('Qmc5..'),
    CID.parse('QmZb..'),
    CID.parse('QmSo..')
    ]
    for await (const { cid, type } of ipfs.pin.ls({ paths })) {
    console.log({ cid, type })
    }
    // { cid: CID(Qmc5XkteJdb337s7VwFBAGtiaoj2QCEzyxtNRy3iMudc3E), type: 'recursive' }
    // { cid: CID(QmZbj5ruYneZb8FuR9wnLqJCpCXMQudhSdWhdhp5U1oPWJ), type: 'indirect' }
    // { cid: CID(QmSo73bmN47gBxMNqbdV6rZ4KJiqaArqJ1nu5TvFhqqj1R), type: 'indirect' }

    Parameters

    • Optional options: LsOptions & OptionExtension

    Returns AsyncIterable<LsResult>

  • rm(ipfsPath: string | CID, options?: RmOptions & OptionExtension): Promise<CID>
  • Unpin this block from your repo

    example
    const cid = CID.parse('QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u')
    const result = await ipfs.pin.rm(cid)
    console.log(result)
    // prints the CID that was unpinned
    // CID('QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u')

    Parameters

    • ipfsPath: string | CID
    • Optional options: RmOptions & OptionExtension

    Returns Promise<CID>

  • Unpin one or more blocks from your repo

    example
    const source = [
    CID.parse('QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u')
    ]
    for await (const cid of ipfs.pin.rmAll(source)) {
    console.log(cid)
    }
    // prints the CIDs that were unpinned
    // CID('QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u')

    Parameters

    Returns AsyncIterable<CID>

Generated using TypeDoc