
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
node-red-contrib-file-buffer
Advanced tools
Node-RED Node to be used in conjunction with the http multipart in node. As the multipart node does not provide a buffer, this node can be used to load a file using a path into a buffer or as a stream.
Run the following command in the root directory of your Node-RED install:
npm install node-red-contrib-file-buffer
Set msg.payload to a file path. If you are using the http in multipart node then the path for the first file will be
var files = Object.keys(msg.req.files);
msg.payload = msg.req.files[files[0]][0].path;
msg.payload will be a buffer or a stream containing the file contents.
This flow uses a multipart form to send a file to Watson Recognition for classification.
[{"id":"eb836b23.3e0a68","type":"http response","z":"a0fe910.b40c17","name":"","x":615,"y":119,"wires":[]},{"id":"bb218734.439a58","type":"httpInMultipart","z":"a0fe910.b40c17","name":"Classify Image","url":"/classify","method":"post","fields":"[{ \"name\":\"pic\"}]","swaggerDoc":"","x":86,"y":177,"wires":[["d75e6046.76f49"]]},{"id":"11b6c481.a08d3b","type":"http in","z":"a0fe910.b40c17","name":"Get Home Page","url":"/homepage","method":"get","swaggerDoc":"","x":85,"y":107,"wires":[["31531035.4de9d"]]},{"id":"31531035.4de9d","type":"template","z":"a0fe910.b40c17","name":"Form and Response Template","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":" <html>\n <body>\n <form action=\"/classify\" method=\"post\" enctype=\"multipart/form-data\">\n <input type=\"file\" name=\"pic\" accept=\"image/*\"><br>\n <input type=\"submit\" value=\"Submit\">\n </form> \n <div>Classifications:</div>\n <div>\n {{#result}}\n <table>\n <tr>\n <th>Class</th>\n <th>Score</th>\n <th>Type</th>\n </tr>\n {{#images}}\n {{#.}}\n {{#classifiers}}\n {{#.}}\n {{#classes}}\n {{#.}}\n <tr>\n <td>{{class}}</td>\n <td>{{score}}</td> \n <td>{{&type_hierarchy}}</td>\n </tr> \n {{/.}} \n {{/classes}} \n {{/.}} \n {{/classifiers}}\n {{/.}}\n {{/images}}\n </table>\n {{/result}}\n </div>\n </body>\n</html>","x":364.5,"y":117,"wires":[["eb836b23.3e0a68"]]},{"id":"d75e6046.76f49","type":"function","z":"a0fe910.b40c17","name":" Determine File Path","func":"if (msg.req.files) {\n var files = Object.keys(msg.req.files);\n msg.payload = msg.req.files[files[0]][0].path; \n}\nreturn msg;","outputs":1,"noerr":0,"x":109.5,"y":234,"wires":[["bea9b8a5.b99eb8"]]},{"id":"50dca2d0.e3764c","type":"visual-recognition-v3","z":"a0fe910.b40c17","name":"","apikey":"","image-feature":"classifyImage","lang":"en","x":345,"y":233,"wires":[["969cd9bb.6d62f8","31531035.4de9d"]]},{"id":"969cd9bb.6d62f8","type":"debug","z":"a0fe910.b40c17","name":"","active":true,"console":"false","complete":"result","x":556.5,"y":277,"wires":[]},{"id":"bea9b8a5.b99eb8","type":"file-buffer","z":"a0fe910.b40c17","name":"","x":144,"y":307,"wires":[["50dca2d0.e3764c"]]}]
For simple typos and fixes please just raise an issue pointing out our mistakes. If you need to raise a pull request please read our contribution guidelines before doing so.
Copyright 2017 IBM Corp. under the Apache 2.0 license.
FAQs
Create a file buffer for a file
The npm package node-red-contrib-file-buffer receives a total of 19 weekly downloads. As such, node-red-contrib-file-buffer popularity was classified as not popular.
We found that node-red-contrib-file-buffer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.