Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Latest commit

 

History

History
100 lines (66 loc) · 2.05 KB

REPO.md

File metadata and controls

100 lines (66 loc) · 2.05 KB

Repo API

repo.gc

Perform a garbage collection sweep on the repo.

ipfs.repo.gc([options])

Where:

  • options is an object that contains following properties
    • quiet writes a minimal output.
    • stream-errors stream errors.

Returns

Type Description
AsyncIterable<Object> An async iterable that yields objects describing nodes that were garbage collected

Each yielded object contains the following properties:

  • err is an Error if it was not possible to GC a particular block.
  • cid is the CID of the block that was Garbage Collected.

Example:

for await (const res of ipfs.repo.gc()) {
  console.log(res)
}

repo.stat

Get stats for the currently used repo.

ipfs.repo.stat([options])

stats.repo and repo.stat can be used interchangeably.

Where:

  • options is an object that contains following properties
    • human a Boolean value to output repoSize in MiB.

Returns

Type Description
Promise<Object> An object containing the repo's info

the returned object has the following keys:

Example:

const stats = await ipfs.repo.stat()
console.log(stats)

// { numObjects: 15,
//   repoSize: 64190,
//   repoPath: 'C:\\Users\\henri\\AppData\\Local\\Temp\\ipfs_687c6eb3da07d3b16fe3c63ce17560e9',
//   version: 'fs-repo@6',
//   storageMax: 10000000000 }

repo.version

Show the repo version.

ipfs.repo.version()

Returns

Type Description
Promise<String> A String containing the repo's version

Example:

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

// "6"