Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | export type IPFS = {
  add(data: FileContent, options?: unknown): UnixFSFile
  cat(cid: CID): AsyncIterable<FileContentRaw>
  ls(cid: CID): AsyncIterable<UnixFSFile>
  dns(domain: string): Promise<CID>
  dag: DagAPI
  files: FilesAPI
  object: ObjectAPI
  pin: PinAPI
  swarm: SwarmAPI
}
 
export type DAGNode = {
  Links: DAGLink[]
  size: number
  toDAGLink: (opt?: { name?: string }) => Promise<DAGLink>
  addLink: (link: DAGLink) => void
  rmLink: (name: string) => void
  toJSON: () => Record<string, unknown>
}
 
export type DAGLink = {
  Name: string
  Hash: CIDObj
  Tsize: number
}
 
export type RawDAGNode = {
  remainderPath: string
  value: {
    Data: Uint8Array
    Links: RawDAGLink[]
    _size: number
    _serializedSize: number
  }
}
 
export type RawDAGLink = {
  Name: string
  Hash: CIDObj
  Tsize: number
}
 
export interface DagAPI {
  put(dagNode: unknown, options?: unknown): Promise<CIDObj>
  get(cid: string | CID | CIDObj, path?: string, options?: unknown): Promise<RawDAGNode>
  resolve(cid: string | CID | CIDObj): Promise<{ cid: CIDObj }>
  tree(cid: string | CID | CIDObj, path?: string, options?: unknown): Promise<Array<string>>
}
 
export interface FilesAPI {
  stat: (cid: CID | CIDObj) => Promise<{ cumulativeSize: number }>
}
 
export interface ObjectAPI {
  stat(cid: CID | CIDObj): Promise<ObjStat>
  put(dagNode: unknown, options: unknown): Promise<CIDObj>
  get(cid: CID, path?: string, options?: unknown): Promise<RawDAGNode>
  tree(cid: CID, path?: string, options?: unknown): Promise<unknown>
}
 
export interface PinAPI {
  add(cid: CID | CIDObj, opts?: { recursive?: boolean }): Promise<Array<CIDObj>>
}
 
export type CID = string
export type Codec = string
export type MultibaseName = string
 
export type CIDObj = {
  codec: Codec
  multibaseName: MultibaseName
  version: number
  toV1(): CIDObj
  toString(): string
}
 
export type FileContent = Record<string, unknown> | Buffer | Blob | string | number | boolean
export type FileContentRaw = Buffer
 
export type FileMode = number
 
export type UnixFSFile = {
  cid: CIDObj
  path: string
  size: number
  mode?: FileMode
  mtime?: number
  name?: string
  type?: string
}
 
export type ObjStat = {
  Hash: string
  NumLinks: number
  BlockSize: number
  LinksSize: number
  DataSize: number
  CumulativeSize: number
}
 
export type AddResult = {
  cid: CID
  size: number
  isFile: boolean
}
 
export type SwarmAPI = {
  connect: (address: string) => Promise<unknown>
}
  |