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

Add flag to list cumulative size of directories #5804

Open
dokterbob opened this issue Nov 29, 2018 · 4 comments
Open

Add flag to list cumulative size of directories #5804

dokterbob opened this issue Nov 29, 2018 · 4 comments
Labels
kind/enhancement A net-new feature or improvement to an existing feature topic/ls API Topic ls API

Comments

@dokterbob
Copy link
Contributor

dokterbob commented Nov 29, 2018

Version information:

0.4.18

Type:

Enhancement

Description:

Currently, the web view of directories lists the cumulative size, that is the on-disk size of directories. However, the ipfs file ls and the ipfs ls commands do not - the former always returns 0 (for the current directory) and the latter returns the size of the directory node only (the size of the list of links).

My personal stance is that there should be consistency between the web interface and the command line and at least one of the ls commands should return the cumulative size. However, @schomatis suggested in #4580 that a command line flag might be added to ipfs file ls and ipfs ls so that it returns the cumulative size for directories. I would suggest this would be in addition to the currently returned Size, similar to the way ipfs files stat returns both Size and CumulativeSize.

Alternately, he suggested adding an ipfs du command returning the 'on disk' size of items. But given that the current set of commands is already kind of a mess, I would strongly suggest not adding another command before giving it considerate thought.

Note that, to the best of my knowledge, ipfs file ls is to be deprecated over ipfs ls.

@dokterbob
Copy link
Contributor Author

Related #5663

@Stebalien Stebalien added the kind/enhancement A net-new feature or improvement to an existing feature label Nov 29, 2018
@kevina kevina added the topic/ls API Topic ls API label Dec 2, 2018
@kjzz
Copy link
Contributor

kjzz commented Dec 3, 2018

Hi @dokterbob , i am interested in this issue, can i help you do for this and #5663 ?

@dokterbob
Copy link
Contributor Author

@kjzz Sure. I won't have time to implement it myself but would be happy to reflect/discuss the feature as I would be an avid user thereof.

It would be great if we could also tackle #5807 - that is, if this information is already available from the context, i.e. it would not use extra resources. This would save us (=ipfs-search.com) an additional stat call. But it is not essential.

@jolatechno
Copy link

Hi, I also needed to know directory size when listing object for a project, so I've done a quite basic implementation in go of the list function of the ipfs shell that returns the directory size by recursively adding all object sizes:

https://github.com/jolatechno/go-ipfs-directory_size_ls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A net-new feature or improvement to an existing feature topic/ls API Topic ls API
Projects
None yet
Development

No branches or pull requests

5 participants