Parse multipart file using formidable
See original GitHub issueHi all,
I am receiving a multipart file via a REST service call to a vendors API. This file includes XML data and blob data for two images. I need to be able to split and store these as individual files using Node/Express. I have seen a lot posts/resources on multipart form data, but my needs are parsing this using JavaScript into individual files that can then be uploaded into Azure Blob Storage. I suspect Node/Express or a Node module such as request (https://github.com/request/request) would be the right way to go, but haven’t found anything concrete. Here is an example of the multipart file. Note that there is not filename for the multipart file:
MIME-Version:1.0
Content-Type:multipart/mixed;
boundary="----=_Part_4_153315749.1440434094461"
------=_Part_4_153315749.1440434094461
Content-Type: application/octet-stream; name=Texture_1.png
Content-ID: response-1
Content-Disposition: attachment; filename=Texture_1.png
‰PNG
"blob data here"
------=_Part_4_153315749.1440434094461
Content-Type: application/octet-stream; name=manifest.xml
Content-ID: response-2
Content-Disposition: attachment; filename=manifest.xml
<?xml version="1.0"?>
<dae_root>blank_3D.dae</dae_root>
------=_Part_4_153315749.1440434094461
Content-Type: application/octet-stream; name=texture_3D.dae
Content-ID: response-3
Content-Disposition: attachment; filename=texture_3D.dae
<xml data here... lots of xml data>
------=_Part_4_153315749.1440434094461
Content-Type: application/octet-stream; name=Texture_0.png
Content-ID: response-4
Content-Disposition: attachment; filename=Texture_0.png
‰PNG
"blob image data"
Is this something that Formidable can manage, and if so, how?
Thanks,
K.
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Uploading Files using Formidable in a Node.js Application
In this article, we will learn how we can upload files using node.js, express, and formidable. Formidable is a Node.js module for parsing...
Read more >Formidable: Parse multipart/form-data request THEN upload file
The idea of multer and formidable is to write the file to the uploadDir as the request is being consumed. If you do...
Read more >Parse multipart file using formidable · Issue #355 - GitHub
Hi all, I am receiving a multipart file via a REST service call to a vendors API. This file includes XML data and...
Read more >Using formidable to handle file uploads | Node Cookbook
In this recipe, we will use the formidable module as our multipart parser to handle file uploads. Getting ready. First, let's create a...
Read more >formidable
Fast (~500mb/sec), non-buffering multipart parser · Automatically writing file uploads to disk · Low memory footprint · Graceful error handling · Very high...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Check this example https://github.com/node-formidable/node-formidable/blob/master/example/multipartParser.js. it shows how to use the multipart parser as standalone
@GrosSacASac I understand that this is possible and I can also do
npm install formidable@canary
but I’m under the impression that “canary” means not production?Edit: But I understand now, the example code is meant to be used with the latest release and I probably have to adjust it for the stable release. Thanks!