Skip to content

Commit 055a1fe

Browse files
authored
Documentation for deleting files (#789)
* Documentation for deleting files Closes #726 * Update files.md * Update files.md
1 parent b36fc11 commit 055a1fe

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

_includes/js/files.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,16 @@ You can delete files that are referenced by objects using the [REST API]({{ site
117117

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

120+
Alternatively, starting with Parse Server 4.2.0, you can delete files using cloud code.
121+
122+
```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+
});
128+
```
129+
120130
## Adding Metadata and Tags
121131

122132
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)