mirror of
https://github.com/IrosTheBeggar/mStream.git
synced 2025-10-27 07:31:02 +00:00
50 lines
1004 B
Markdown
50 lines
1004 B
Markdown
**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 <br />
|
|
**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 <br />
|
|
**Content:** `{ error: 'Not a directory' }`
|