2011-10-30 57 views
3

是否有一個Node.js庫用於生成以下形式的多部分/表單數據內容?Node.js - 生成多部分/表單數據

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

回答

2

fermata看起來它可能是你要找的。從GitHub的頁面:

fermata.json("http://example.com/some/action").post({ 
    'Content-Type':"multipart/form-data" 
}, { 
    fileField: form.input.file || {data:nodeBuffer, name:"", type:""} 
}, callback)