Save File

Overview

The File Storage Component allows saving a file to the database with its metadata, including filename, MIME type, and encoding. This component enables efficient file storage and retrieval for various applications.

Usage

This component is useful when files need to be uploaded and stored securely in a database for further processing or retrieval.

Properties

Property
Type
Description

filename

string

The name of the file to be stored.

mimetype

string

The MIME type of the file.

content

array / string

The content of the file to be saved.

contentEncoding

string

The encoding format of the content (e.g., utf8, base64, hex).

Input Ports

Port
Description

in

Accepts the file details for storage.

Output Ports

Port
Description

file

Emits metadata of the successfully stored file.

Processing Logic

  1. Receives Input Data:

    • Accepts filename, mimetype, content, and contentEncoding.

  2. Saves the File:

    • Stores the file in the database.

    • Uses the specified encoding format for content.

  3. Confirms Storage:

    • Emits metadata of the stored file, including its unique fileId, filename, and contentType.

    • If an error occurs (e.g., invalid content), it is logged or raised appropriately.

Output Data Schema

Property
Type
Description

fileId

string

The identifier of the stored file.

filename

string

The name of the stored file.

contentType

string

The MIME type of the stored file.

Notes

  • Supports Various Encoding Formats: Content encoding options include utf8, base64, hex, and more.

  • Secure and Reliable Storage: Ensures files are stored securely in the database.

  • Ideal for File Upload and Management Workflows: Enables seamless file handling for applications requiring document storage and retrieval.

Last updated

Was this helpful?