使用来自节点的表单数据模块我已经将zip文件提交到rails后端。我不知道如何将数据一旦到达目的地就将其转换为文件。如果你想知道为什么有人会把一个用节点构建的表单提交到rails后端,那么因为电子!我正在构建桌面应用程序,我需要将内容推送到构建在rails上的现有后端。我花了3个完整的工作日试图成功地将一个zip文件发布到rails端点而没有运气,我确实没有想法(失败不是一个选项)。如何打开名为' data'的数据缓冲区?成zip文件?如果有人能指出我适用的资源或教程,我自己也可以编写代码,我自己也找不到代码。谢谢!
{
"attachment":{
"_overheadLength":157,
"_valueLength":0,
"_lengthRetrievers":[
null
],
"writable":false,
"readable":true,
"dataSize":0,
"maxDataSize":2097152,
"pauseStreams":true,
"_released":false,
"_streams":[
"----------------------------860185489573893683941879\r\nContent-Disposition: form-data; name=\"app.zip\"; filename=\"app.zip\"\r\nContent-Type: application-zip\r\n\r\n",
{
"source":{
"_readableState":{
"objectMode":false,
"highWaterMark":65536,
"buffer":[
{
"type":"Buffer",
"data":[
80,
181
]
}
],
"length":65536,
"pipes":null,
"pipesCount":0,
"flowing":false,
"ended":false,
"endEmitted":false,
"reading":false,
"sync":false,
"needReadable":false,
"emittedReadable":true,
"readableListening":false,
"defaultEncoding":"utf8",
"ranOut":false,
"awaitDrain":0,
"readingMore":false,
"decoder":null,
"encoding":null
},
"readable":true,
"domain":null,
"_events":{
},
"_eventsCount":3,
"path":"/Users/guest/Library/Application Support/foundation-apps-template/app.zip",
"fd":299,
"flags":"r",
"mode":438,
"autoClose":true
},
"dataSize":0,
"maxDataSize":null,
"pauseStream":true,
"_maxDataSizeExceeded":false,
"_released":false,
"_bufferedEvents":[
],
"_events":{
},
"_eventsCount":1
},
null
],
"_currentStream":null,
"_boundary":"--------------------------860185489573893683941879"
} }