> For the complete documentation index, see [llms.txt](https://docs.eueno.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eueno.io/eueno-libraries/eueno-lib-node/upload-file.md).

# Upload file

#### Syntax

#### &#x20;                                               eueno.upload(input,`[opts],metadata`)

#### Example

```
const Eueno = require('@eueno/lib-node');
const fs = require('fs');

async function example() {
  const eueno = new Eueno({
    endpoint: 'https://v2-developers.eueno.io',
  });
  const file = await fs.readFileSync('1.png');

  const data = await eueno.upload(
    file,
    {
      projectKey: 'project_key',
      key: {
        walletPublicKey: 'public_key_of_user_if_method_encrypt',
        fileEncryptionKey: 'key_encrypt_file'
      },
    },
    {
      projectId: 129,
      filename: '1.png',
      contentLength: 12313,
      contentType: 'image/png',
      method: 'ENCRYPT',
      keepPath: false,
    },
  );
}


example();
```

## Parameters

<table><thead><tr><th width="135">Name</th><th width="107">Type</th><th width="119">Required</th><th>Description</th></tr></thead><tbody><tr><td>Input</td><td>Buffer</td><td>Yes</td><td>Buffer file data</td></tr><tr><td>opts</td><td>Object</td><td>Yes</td><td>Initialization parameter</td></tr><tr><td>metadata</td><td>Object</td><td>Yes</td><td>Info a file and project</td></tr></tbody></table>

## Properties <a href="#properties" id="properties"></a>

**opts**

<table><thead><tr><th width="135">Name</th><th width="107">Type</th><th width="119">Required</th><th>Description</th></tr></thead><tbody><tr><td>projectKey</td><td>String</td><td>Yes</td><td>project key to authenticate client and eueno server</td></tr><tr><td>key</td><td>Object</td><td>No</td><td>The keys in encrypting the file if the storage method is encryption.</td></tr></tbody></table>

**key**

<table><thead><tr><th width="191">Name</th><th width="107">Type</th><th width="119">Required</th><th>Description</th></tr></thead><tbody><tr><td>walletPublicKey</td><td>String</td><td>Yes</td><td>public key of the user used to encrypt the file encryption key <code>fileEncryptionKey</code></td></tr><tr><td>fileEncryptionKey</td><td>String</td><td>No</td><td>Symmetric key used to encrypt files</td></tr></tbody></table>

**metadata**&#x20;

<table><thead><tr><th width="170">Name</th><th width="107">Type</th><th width="119">Required</th><th>Description</th></tr></thead><tbody><tr><td>projectId</td><td>Int</td><td>Yes</td><td>Id project eueno</td></tr><tr><td>path</td><td>String </td><td>No</td><td>Path storage on eueno</td></tr><tr><td>filename</td><td>String</td><td>Yes</td><td>Name of file</td></tr><tr><td>contentLength</td><td>Int</td><td>Yes</td><td>Size of file</td></tr><tr><td>contentType</td><td>String</td><td>Yes</td><td>Type of file eg: image/png</td></tr><tr><td>method</td><td>String</td><td>Yes</td><td>Encrypted or Unencrypted Storage Method <code>ENCRYPT</code> or UNENCRYPTED</td></tr><tr><td>keepPath</td><td>Boolean</td><td>No</td><td>To avoid duplicate names on eueno's mfs system, we will add a datetime field to the name of the file.</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.eueno.io/eueno-libraries/eueno-lib-node/upload-file.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
