Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@
"ipfs-bitswap": "^0.26.0",
"ipfs-block": "~0.8.1",
"ipfs-block-service": "~0.16.0",
"ipfs-http-client": "^39.0.2",
"ipfs-http-client": "ipfs/js-ipfs-http-client#fix/repo-stat",
"ipfs-http-response": "~0.4.0",
"ipfs-mfs": "^0.13.0",
"ipfs-multipart": "^0.2.0",
"ipfs-repo": "^0.29.0",
"ipfs-repo": "ipfs/js-ipfs-repo#fix/human-readable-option",
"ipfs-unixfs": "~0.1.16",
"ipfs-unixfs-exporter": "^0.38.0",
"ipfs-unixfs-importer": "^0.40.0",
Expand Down Expand Up @@ -204,7 +204,7 @@
"execa": "^3.0.0",
"form-data": "^3.0.0",
"hat": "0.0.3",
"interface-ipfs-core": "^0.119.0",
"interface-ipfs-core": "github:ipfs/interface-js-ipfs-core#test/add-human-option-test-repo-stat",
"ipfs-interop": "^0.1.1",
"ipfsd-ctl": "^0.47.2",
"libp2p-websocket-star": "~0.10.2",
Expand Down
12 changes: 6 additions & 6 deletions src/cli/commands/repo/stat.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ module.exports = {
argv.resolve((async () => {
const ipfs = await argv.getIpfs()
const stats = await ipfs.repo.stat({ human: argv.human })
argv.print(`repo status
number of objects: ${stats.numObjects}
repo size: ${stats.repoSize}
repo path: ${stats.repoPath}
version: ${stats.version}
maximum storage: ${stats.storageMax}`)
argv.print(
`NumObjects: ${stats.numObjects}
RepoSize: ${stats.repoSize}
StorageMax: ${stats.storageMax}
RepoPath: ${stats.repoPath}
Version: ${stats.version}`)
})())
}
}
12 changes: 12 additions & 0 deletions test/cli/repo.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,16 @@ describe('repo', () => runOnAndOff((thing) => {
const out = await ipfs('repo version')
expect(out).to.eql(`${repoVersion}\n`)
})

it('get repo stats', async () => {
const stats = await ipfs('repo stat')
expect(stats).to.match(/^RepoSize:\s+\d+$/gm)
expect(stats).to.match(/^StorageMax:\s+\d+$/gm)
})

it('get human readable repo stats', async () => {
const stats = await ipfs('repo stat --human')

expect(stats).to.match(/\s.?B$/gm)
})
}))