npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-red-contrib-file-buffer

v0.0.3

Published

Create a file buffer for a file

Readme

node-red-contrib-file-buffer

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.

Install

Run the following command in the root directory of your Node-RED install:

    npm install node-red-contrib-file-buffer

Usage

Input

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;

Output

msg.payload will be a buffer or a stream containing the file contents.

Sample flow

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"]]}]

Contributing

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 and license

Copyright 2017 IBM Corp. under the Apache 2.0 license.