Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: human readable option #213

Merged
merged 3 commits into from
Nov 14, 2019
Merged

fix: human readable option #213

merged 3 commits into from
Nov 14, 2019

Conversation

PedroMiguelSS
Copy link
Contributor

This PR fixes the output of human option that can be passed to repo.stat ([options]).

Both repoSize and storageMax properties of the returned object are now according to go implementation:

  • repoSize -> represented in MB
  • storageMax -> represented in GB

Example:

const stats = await repo.stat({ human: true })
console.log(stats)
// Logs:
//{
//  repoPath: '/var/folders/l1/l5dg09hj7x9d6yxm5z2vsr2h0000gn/T/test-repo-for-1573141229356',
//  storageMax: '10 GB',
//  version: 7,
//  numObjects: 24,
//  repoSize: '0.07 MB'
//}

Closes ipfs/js-ipfs#1996.

src/index.js Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
@PedroMiguelSS
Copy link
Contributor Author

Can I get a second review here, please? @achingbrain @hugomrdias @jacobheun

@jacobheun jacobheun merged commit bf0f170 into master Nov 14, 2019
@jacobheun jacobheun deleted the fix/human-readable-option branch November 14, 2019 14:58
@jacobheun
Copy link
Contributor

Released in v0.29.1

@alanshaw
Copy link
Member

I'd like to keep formatting functionality out of ipfs core - it bloats the bundle size, makes assumptions about locale and can be easily added by applications using IPFS.

What do you think? I'd be in favour of removing this functionality altogether and pushing it into the CLI and HTTP API resources.

@PedroMiguelSS
Copy link
Contributor Author

I got your point. It makes sense. What do you think @achingbrain @jacobheun?

@jacobheun
Copy link
Contributor

What do you think? I'd be in favour of removing this functionality altogether and pushing it into the CLI and HTTP API resources.

This sounds like a good approach to me.

@achingbrain
Copy link
Member

Me too, formatting is a UI concern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ipfs repo stat --human
4 participants