> ## Documentation Index
> Fetch the complete documentation index at: https://docs.codenullapp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage Multimedia Files

> If you want to upload files to your Azure Blob Storage Subscriptions enabled in the application settings directly from hooks, this is how you can do it

If you want to upload files to your Azure Blob Storage Subscriptions enabled in the application settings directly from hooks, this is how you can do it

```javascript theme={null}
const multimediaService = require("./utils/multimediaService");

//upload from a buffer
await multimediaService.uploadFileBufferToAzureAsync(file);


//upload from a stream
await multimediaService.uploadFileStreamToAzureAsync(stream, file);

//remove a file from azure storage
await multimediaService.deleteFileFromAzureAsync("filename");

```

The `file` param should have the following attributes

```javascript theme={null}

{
    mimetype, // string | required
    buffer // required if you are using uploadFileBufferToAzureAsync method
    filename
    originalname // required if you are not passing the filename
}

```

The returned object after calling any of those methods will have the next data

```javascript theme={null}
{
    mimetype, 
    buffer 
    filename
    originalname,
    url, // this will be where you can find your file
    storage //azure by default if enabled
}
```

Additional Parameter for `uploadFileStreamToAzureAsync and` uploadFileBufferToAzureAsync

**omitPrefix** (boolean, optional): When set to `true`, the uploaded file's name will be set to the original name or the provided filename without a timestamp prefix. If set to `false`, the filename will include a timestamp prefix.

```javascript theme={null}
const multimediaService = require("./utils/multimediaService");
//upload from a buffer 
await multimediaService.uploadFileBufferToAzureAsync(file, true); // omitPrefix 
//upload from a stream 
await multimediaService.uploadFileStreamToAzureAsync(stream, file, true); // omitPrefix 
```

```json theme={null}
{
    "mimetype": "text/plain",
    "filename": "_file",
    "url": "https://urlazure/app/app/_file",
    "storage": "azure"
}
```
