Skip to content

mfs list command api return types #5026

Open
@achingbrain

Description

@achingbrain

The interface-ipfs-core mfs ls command tests seem to be based on the go implementation's behaviour but I'd like to know if the below was intentional.

If you ipfs.files.ls('/directory') you get this sort of structure back:

[
  { name: 'my-file.txt', type: 0, size: 0, hash: '' },
  { name: 'my-directory', type: 0, size: 0, hash: '' }
]

If you ipfs.files.ls('/directory', {l: true}), you get:

[
   {
    name: 'my-file.txt',
    type: 0,
    size: 13,
    hash: 'QmcZojhwragQr5qhTeFAmELik623Z21e3jBTpJXoQ9si1T'
  },
  {
     name: 'my-directory',
     type: 1,
     size: 0,
     hash: 'QmaSPtNHYKPjNjQnYX9pdu5ocpKUQEL3itSz8LuZcoW6J5'
  }
]

In the first example you get type: 0, size: 0, hash: '' which look like they should be omitted from the response.

In the second, the type field has a numeric value instead of file or directory which conflicts with the spec.

Also, has anyone got an opinion about having long be the option field name instead of l? Seems a bit more self-explanatory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions