# deleteFile()

## Syntax

```javascript
deleteFile(file_id: string | number, token?: string)
```

Delete the file by id.

## Parameters

<table><thead><tr><th width="144">Name</th><th width="121">Type</th><th width="108">Required</th><th>Description</th></tr></thead><tbody><tr><td>file_id</td><td>string or number</td><td>Yes</td><td>The file id.</td></tr><tr><td>token</td><td>string</td><td>No</td><td>The authentication token response from Eueno API when login. After login, this token was saved in local storage with the name “eueno-token".</td></tr></tbody></table>

## Example

```javascript
import { deleteFile } from "@eueno/lib-browser";
 
const handleDeleteFile = async () => {
   if (!token) return toast.error("Token null!");
   try {
     const id = “220428”;
     const res = await deleteFile(id);
     if (res.status === 200) {
       console.log("Delete successfully");
     }
   } catch (error) {
     console.error(error);
   }
 };

```

Response of example:

```javascript
{
    "msg": "success"
}
```
