我正通過REST服務調用接收供應商API的多部分文件。該文件包含兩個圖像的XML數據和blob數據。我需要能夠使用Node/Express將這些文件分割並存儲爲單個文件。我已經在多部分表單數據上看到了很多帖子/資源,但是我的需求是使用JavaScript將其解析爲單個文件,然後將其上載到Azure Blob存儲中。我懷疑節點/快車或節點模塊,如請求(https://github.com/request/request)是正確的路要走,但沒有找到具體的東西。這是一個multipart文件的例子。請注意,有沒有文件名的分段文件:使用Node/Express解析多部分文件並上傳到Azure Blob存儲
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"
你可用於提供完整的xml文件內容以便於測試? –
當然@ GaryLiu-MSFT,試試這個鏈接:https://dl.dropboxusercontent.com/u/46697217/MultipartTest – Kode