Skip to content

Repository files navigation

@bonsae/node-red-file-storage

File storage nodes for Node-RED built with @bonsae/nrg. Read and write files across multiple storage backends with a unified API.

Nodes

Node Description
File Storage Config node — selects and configures a storage backend (local, S3, GCS, or Azure) shared by the read/write nodes
File Read Read a file from the configured backend as a string, Buffer, or readable stream
File Write Write, append, or delete a file in the configured backend

Prerequisites

Supported Backends

Backend Adapter Use Case
Local File System @flystorage/local-fs Development, edge deployments
Amazon S3 @flystorage/aws-s3 Also works with R2, DigitalOcean Spaces, MinIO
Google Cloud Storage @flystorage/google-cloud-storage GCP workloads
Azure Blob Storage @flystorage/azure-storage-blob Azure workloads

Installation

npm install @bonsae/node-red-file-storage

Cloud SDKs are optional dependencies. They are only needed if you use the corresponding backend:

# For S3
npm install @aws-sdk/client-s3

# For Google Cloud Storage
npm install @google-cloud/storage

# For Azure Blob Storage
npm install @azure/storage-blob

Node reference

File Storage (Configuration)

Configures a storage backend shared by the File Read and File Write nodes. Each backend has its own set of configuration fields:

  • Local: Root directory path
  • S3: Bucket, region, optional prefix. Credentials via Access Key ID / Secret Access Key
  • GCS: Bucket, project ID, optional prefix. Credentials via service account key file
  • Azure: Container, optional prefix. Credentials via connection string

File Read

Reads a file from the configured storage backend.

Config:

  • Storage - File Storage configuration node
  • File Path - Path relative to the storage root (supports str or msg types)
  • Output As - string, buffer, or stream
  • Encoding - Character encoding when output is string (UTF-8, ASCII, Latin-1, etc.)

Input: Any message triggers the read.

Output — the read merges its fields onto the message (Node-RED's accumulating record); the incoming fields are preserved:

  • msg.payload - File content as string, Buffer, or Readable stream
  • msg.filename - Path of the file that was read

File Write

Writes, appends, or deletes a file in the configured storage backend.

Config:

  • Storage - File Storage configuration node
  • File Path - Path relative to the storage root (supports str or msg types)
  • Action - overwrite, append, or delete
  • Create Directory - Auto-create parent directories if they don't exist
  • Add Newline - Append a trailing newline after data (append mode only)
  • Encoding - Character encoding when writing string content

Input: msg.payload as string, Buffer, or Readable stream.

Output — merges its result field onto the message (Node-RED's accumulating record); the incoming fields are preserved:

  • msg.filename - Path of the file that was written/deleted

Development

# Install dependencies
pnpm install

# Start the dev server (Node-RED with hot reload)
pnpm dev

# Build for production
pnpm build

# Type-check, lint, and format-check
pnpm validate

# Run unit tests
pnpm test

License

BUSL-1.1

About

File Storage nodes for Node-RED with streaming support

Topics

Resources

Stars

Watchers

Forks

Releases

Contributors

Languages