mStream/docs/API/dirparser.md
2017-03-04 01:45:09 -05:00

1004 B

Get Directory Contents

Used to make a file browser. Dirparser will only return contents that are music files or other directories. Users will not be able to see any other files

  • URL

    /dirparser

  • Method:

    POST

  • JSON Params

    Required:

    dir - directory to get contents from

    Optional:

    filetypes - limit filetypes of returned responses. Useful is your platform does not support all filetypes

  • JSON Example

    {
      'dir':'current/directory/',
      'filetypes':['mp3', 'wav', 'flac']
    }
    
  • Success Response:

    • Code: 200
      Content:

      {
        path: 'current/directory/',
        contents: [{ type: 'directory', filepath: folder1}, { type: 'mp3', filepath: file1.mp3}]
      }
      

      'type' will either be 'directory' or the file extension. 'filepath' should be renamed to 'filename'

  • Error Response:

    • Code: 500 NOT FOUND
      Content: { error: 'Not a directory' }