Initial commit

Co-Authored-By: kotte <14197736+mrtamagotchi@users.noreply.github.com>
Co-Authored-By: mikaeltellhed <2311083+mikaeltellhed@users.noreply.github.com>
Co-Authored-By: Tore Knudsen <18231882+torekndsn@users.noreply.github.com>
Co-Authored-By: Michael Cartner <32543275+michaelcartner@users.noreply.github.com>
This commit is contained in:
Eric Tuvesson
2023-09-05 12:08:55 +02:00
commit 53f0d6320e
2704 changed files with 76354 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
---
hide_title: true
hide_table_of_contents: true
title: Noodl.Files
---
# Noodl.Files
The **Noodl.Files** service lets you access the cloud services files.
#### **`Noodl.Files.upload(file,options)`**
**Only available on the frontend**
This function will upload a file to the backend. You can specify a progress callback using the options.
<div className="ndl-image-with-background xl">
![](/javascript/reference/files/upload.png)
</div>
```javascript
const cloudFile = await Noodl.Files.upload(Inputs.File, {
onProgress: (p) => {
console.log(p.total, p.loaded);
},
});
console.log(cloudFile.name);
console.log(cloudFile.url);
```
#### **`Noodl.Files.delete(fileName)`**
**Only available in cloud functions**
This function will delete a file that has been uploaded to the backend. You need to provide the file name that was returned when the file was uploaded. So not the full `url` but the `hash+filename` returned by the upload function.
```javascript
// Can only be done in cloud functions
await Noodl.Files.delete(filename);
```