@yousolution/node-red-contrib-you-stream-upload 1.0.0
Node-RED node that streams multipart uploads directly into PostgreSQL Large Objects
@yousolution/node-red-contrib-you-stream-upload
A collection of Node-RED nodes for handling file streams, including multipart uploads, filesystem operations, and PostgreSQL Large Objects.
Installation
Run the following command in your Node-RED user directory - typically ~/.node-red:
npm install @yousolution/node-red-contrib-you-stream-upload
Nodes
stream-upload
Creates an HTTP endpoint specifically designed for streaming file uploads. It handles multipart/form-data POST requests and outputs a readable stream of the file content.
Usage:
- Configure the Endpoint (e.g.,
/upload-stream). - Send a POST request with a file to that endpoint.
- The node outputs
msg.payloadas a stream, which can be piped to other nodes. - Fields: Any additional text fields sent in the multipart request (must be sent before the file) are available in
msg.fields. - Binary Uploads: Supports raw binary uploads (e.g.,
application/octet-stream). The filename can be specified viaContent-Dispositionorx-filenameheader.
file-stream-upload
Saves a file stream to a specified directory on the local filesystem.
Usage:
- Connect a node that outputs a stream (like
stream-upload) to this node. - Configure the Directory where files should be saved.
- The node saves the file with a unique name (UUID + original filename) and outputs the file path.
pg-stream-upload
Uploads a file stream directly to a PostgreSQL database as a Large Object.
Usage:
- Connect a node that outputs a stream to this node.
- Configure the PostgreSQL connection.
- The node streams the data to a new Large Object and outputs the Object ID (OID).
pg-direct-download
Creates a direct HTTP GET endpoint to download a PostgreSQL Large Object stream.
Usage:
- Configure the PostgreSQL connection and Endpoint (e.g.,
/pg-download). - Access the URL
http://<node-red>/pg-download/<OID>. - The node streams the Large Object with the specified OID directly to the client.
file-direct-download
Creates a direct HTTP GET endpoint to download files from the local filesystem.
Usage:
- Configure the Base Path (directory to serve files from) and Endpoint (e.g.,
/file-download). - Access the URL
http://<node-red>/file-download/<filename>. - The node streams the requested file from the Base Path to the client.
- Security: Prevents directory traversal attacks.
License
MIT