forms - Node.js saving file from multipart native -


i have question: how save file multipart/form-data in native node.js without modules busboy etc?

i have simple form:

<form action="/upload" method="post" enctype="multipart/form-data">     <input type="file" name="file1">     <button type="submit">upload</button> </form> 

and:

app.post('/upload', function(req, res) {     req.on('data', function(chunk) {         console.log(chunk.tostring());     }); }) 

chunk returned this:

------webkitformboundarycatgak18ljanveul content-disposition: form-data; name="file1"; filename="somefile.txt" content-type: text/plain  content txt file... blablabla... ------webkitformboundarycatgak18ljanveul-- 

how can save file this? best way create uploading file system this?


Comments