Upload file

Syntax

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

Name
Type
Required
Description

Input

Buffer

Yes

Buffer file data

opts

Object

Yes

Initialization parameter

metadata

Object

Yes

Info a file and project

Properties

opts

Name
Type
Required
Description

projectKey

String

Yes

project key to authenticate client and eueno server

key

Object

No

The keys in encrypting the file if the storage method is encryption.

key

Name
Type
Required
Description

walletPublicKey

String

Yes

public key of the user used to encrypt the file encryption key fileEncryptionKey

fileEncryptionKey

String

No

Symmetric key used to encrypt files

metadata

Name
Type
Required
Description

projectId

Int

Yes

Id project eueno

path

String

No

Path storage on eueno

filename

String

Yes

Name of file

contentLength

Int

Yes

Size of file

contentType

String

Yes

Type of file eg: image/png

method

String

Yes

Encrypted or Unencrypted Storage Method ENCRYPT or UNENCRYPTED

keepPath

Boolean

No

To avoid duplicate names on eueno's mfs system, we will add a datetime field to the name of the file.

Last updated