@ambucher/node-red-contrib-send-form
NodeRed node for posting multipart/form-data to http server
Last updated 5 months ago by ambucher .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @ambucher/node-red-contrib-send-form 
SYNC missed versions from official npm registry.

node-red-contrib-send-form

This is a node-red node for posting http(s) requests containing files as multipart formData. Currently a work in progress.

Installation

run npm -g install node-red-contrib-send-form

Features

Pulled together using some of the best of parts of other node-red-contrib nodes (particularly node-red-contrib-http-request), and the best parts of stackoverflow. Currently only sends files. However, there are future plans to handle other types multipart/form-data.

Usage

Required node inputs:

  • url (this is specified on the node)
  • file source type:
    • base64 or binary buffer

File

  • Data | Buffer
    Needs to be passed in msg.payload.file.data

  • Name of file field | String
    Needs to be passed in msg.payload.file.field

  • Name of file | String
    Needs to be passed in msg.payload.file.name

  • Source type | String
    Can be selected within the node from a dropdown menu "type" or passed in msg.payload.file.type. Payload overrides the dropdown menu.

    Currently accepts

    • base64
    • binary

Form fields

Can be inserted within the node or passed as part of msg.payload.formOptions.<name of key>

msg.payload.formOptions.params = 'test':

is the same as

<input type=textbox name=params value="test">

Example msg.payload

msg.payload = {
  file: {
    field: 'file',
    data: msg.payload,
    type: 'binary',
    name: 'file'
  },
  formOptions: {
    params: '',
  }
}

same as:

  <form method=post enctype=multipart/form-data>
    <input type=textbox name=params value="">
    <input type=file name=file>
  </form>

Example flow

Check Node-RED Menu Import -> Examples for available examples

Why this module?

As of december 2019, NodeRed does not yet support sending multipart form-data. This module aims to begin to close that gap.

There is always room for improvement, and new ideas are valued. Feel free to submit pull requests to make this library even better.

Current Tags

  • 0.3.22                                ...           latest (5 months ago)

3 Versions

  • 0.3.22                                ...           5 months ago
  • 0.3.21                                ...           5 months ago
  • 0.3.20                                ...           5 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 8
Last Day 0
Last Week 0
Last Month 0
Dependencies (4)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |