Is there a Node.js library for generating multipart/form-data content in the following form?
------------------------------7a9cd2dc11c1
Content-Disposition: form-data; name="to"
[email protected]
------------------------------7a9cd2dc11c1
Content-Disposition: form-data; name="from"
[email protected]
------------------------------7a9cd2dc11c1
Content-Disposition: form-data; name="subject"
subject line
------------------------------7a9cd2dc11c1
Content-Disposition: form-data; name="text"
This content does not matter.
------------------------------7a9cd2dc11c1--
To get started with forms, we will first install the body-parser(for parsing JSON and url-encoded data) and multer(for parsing multipart/form data) middleware. var express = require('express'); var bodyParser = require('body-parser'); var multer = require('multer'); var upload = multer(); var app = express(); app.
Busboy is an event-based streaming parser that's not tied to Express. js. Instead of storing intermediate files, it provides a stream to the incoming file. It's been around since 2013. The core multipart/form-data implementation has been extracted to a separate dicer module.
Parse http requests with content-type multipart/form-data , also known as file uploads. See also busboy - a faster alternative which may be worth looking into.
fermata looks like it might be what you're looking for. From the github page:
fermata.json("http://example.com/some/action").post({
'Content-Type':"multipart/form-data"
}, {
fileField: form.input.file || {data:nodeBuffer, name:"", type:""}
}, callback)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With