Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for deleting files #789

Merged
merged 3 commits into from
Nov 17, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions _includes/js/files.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,23 @@ Parse.Cloud.httpRequest({ url: profilePhoto.url() }).then(function(response) {
});
```


dblythy marked this conversation as resolved.
Show resolved Hide resolved
## Deleting Files

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.

If your files are not referenced by any object in your app, it is not possible to delete them through the REST API.

Alternatively, starting with Parse Server 4.2.0, you can delete files using cloud code.

```javascript
Parse.Cloud.beforeDelete('Profile', async (req) => {
const profile = req.object;
const profilePhoto = profile.get("photoFile");
await profilePhoto.destroy({ useMasterKey: true })
});
```

## Adding Metadata and Tags

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).
Expand Down