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 type, size and (optional) cumulativesize to ipfs ls JSON output #5807

Closed
dokterbob opened this issue Nov 29, 2018 · 1 comment
Closed
Labels
topic/ls API Topic ls API

Comments

@dokterbob
Copy link
Contributor

Version information:

0.4.18

Type:

Enhancement

Description:

Part of #3056 and #3081, we should consider adding a Type, Size and (optional, see #5804) CumulativeSize to the root node for ipfs ls output. This information (except perhaps the cumsize) should already be available when performing the ls and is quite useful for some purposes (i.e. ipfs-search.com), as it saves an additional call to ipfs files stat.

Perhaps it even makes sense to include the full stat output, for consistency?

Current output of ipfs ls --enc=json /ipfs/QmYcutogfHrrxigzVw2Vi8P1cdiuXNn9VecL9cy95wB9MP:

{
  "Objects": [
    {
      "Hash": "/ipfs/QmYcutogfHrrxigzVw2Vi8P1cdiuXNn9VecL9cy95wB9MP",
      "Links": [
        {
          "Name": "reindex",
          "Hash": "Qmac74sj9SgTVVVHFgWrFL6wyUQ8k8sgK4LYcEPTNoz3jW",
          "Size": 18132,
          "Type": 1
        }
      ]
    }
  ]
}

Output of ipfs files stat --enc=json /ipfs/QmYcutogfHrrxigzVw2Vi8P1cdiuXNn9VecL9cy95wB9MP:

{
  "Hash": "QmYcutogfHrrxigzVw2Vi8P1cdiuXNn9VecL9cy95wB9MP",
  "Size": 0,
  "CumulativeSize": 18187,
  "Blocks": 1,
  "Type": "directory"
}

Where we're coming from - ipfs file ls --enc=json:

{
  "Arguments": {
    "/ipfs/QmYcutogfHrrxigzVw2Vi8P1cdiuXNn9VecL9cy95wB9MP": "QmYcutogfHrrxigzVw2Vi8P1cdiuXNn9VecL9cy95wB9MP"
  },
  "Objects": {
    "QmYcutogfHrrxigzVw2Vi8P1cdiuXNn9VecL9cy95wB9MP": {
      "Hash": "QmYcutogfHrrxigzVw2Vi8P1cdiuXNn9VecL9cy95wB9MP",
      "Size": 0,
      "Type": "Directory",
      "Links": [
        {
          "Name": "reindex",
          "Hash": "Qmac74sj9SgTVVVHFgWrFL6wyUQ8k8sgK4LYcEPTNoz3jW",
          "Size": 18132,
          "Type": "Directory"
        }
      ]
    }
  }
}

Related:

@dokterbob
Copy link
Contributor Author

Type and Size seem to have been added by now, CumulativeSize is still lacking. Closing, for now, as CumSize has its own issue now.

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

No branches or pull requests

2 participants