-
Notifications
You must be signed in to change notification settings - Fork 7
FileStore
Jayesh Choudhary edited this page Mar 20, 2019
·
1 revision
Kind: global class
-
FileStore
- new FileStore(appId, url, options)
-
.uploadFile(path, file) ⇒
Promise
-
.createFolder(path, name) ⇒
Promise
-
.listFiles(path) ⇒
Promise
-
.delete(path) ⇒
Promise
Create an instance of the FileStore Interface.
Param | Type |
---|---|
appId | string |
url | string |
options | Object |
Uploads the given file at given path.
Kind: instance method of FileStore
Returns: Promise
- Returns a promise containing response from server.
Param | Type |
---|---|
path | string |
file | file |
Example
const fileInput = document.querySelector('#your-file-input');
api.FileStore().uploadFile("/some-path", fileInput.files[0]).then(res => {
if (res.status === 200) {
console.log("File uploaded successfully");
}
})
Creates a folder with given name at given path.
Kind: instance method of FileStore
Returns: Promise
- Returns a promise containing response from server.
Param | Type |
---|---|
path | string |
name | string |
Example
api.FileStore().createFolder("/some-path", "my-folder").then(res => {
if (res.status === 200) {
console.log("Folder created successfully");
}
})
Returns list of files within a directory.
Kind: instance method of FileStore
Returns: Promise
- Returns a promise containing response from server.
Param | Type |
---|---|
path | string |
Example
api.FileStore().listFiles("/some-path").then(res => ...)
Deletes a file / folder at given path.
Kind: instance method of FileStore
Returns: Promise
- Returns a promise containing response from server.
Param | Type |
---|---|
path | string |
Example
api.FileStore().delete("/some-path").then(res => {
if (res.status === 200) {
console.log("Deleted successfully");
}
})