Skip to content

Commit d368bd1

Browse files
authored
Documentation for deleting files (improvement) (#791)
* improved JS doc for deleting file * removed required reference to delete file * changed bullet point to headline
1 parent 3191782 commit d368bd1

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

_includes/js/files.md

+7-10
Original file line numberDiff line numberDiff line change
@@ -113,20 +113,17 @@ Parse.Cloud.httpRequest({ url: profilePhoto.url() }).then(function(response) {
113113

114114
## Deleting Files
115115

116-
You can delete files that are referenced by objects using the [REST API]({{ site.baseUrl }}/rest/guide/#deleting-files). You will need to provide the master key in order to be allowed to delete a file.
117-
118-
If your files are not referenced by any object in your app, it is not possible to delete them through the REST API.
119-
120-
Alternatively, starting with Parse Server 4.2.0, you can delete files using cloud code.
116+
You can delete files that are referenced by objects using the `destroy` method. The master key is required to delete a file.
121117

122118
```javascript
123-
Parse.Cloud.beforeDelete('Profile', async (req) => {
124-
const profile = req.object;
125-
const profilePhoto = profile.get("photoFile");
126-
await profilePhoto.destroy({ useMasterKey: true })
127-
});
119+
const profilePhoto = profile.get("photoFile");
120+
await profilePhoto.destroy({ useMasterKey: true });
128121
```
129122

123+
#### Parse Server <4.2.0
124+
125+
Use the [REST API]({{ site.baseUrl }}/rest/guide/#deleting-files) to delete a file.
126+
130127
## Adding Metadata and Tags
131128

132129
Adding Metadata and Tags to your files allows you to add additional bits of data to the files that are stored within your storage solution (i.e AWS S3).

0 commit comments

Comments
 (0)