Node.js file upload server without third party module
问题 I want to parse the upload file and saved without any 3rd module but still not success. Do I miss any part? Or it need to convert to buffer first? var http = require('http'); const fs = require ('fs'); http.createServer(function (req, res) { if (req.url == '/fileupload') { var body = ''; req.on('data', (data) => { body += data; }); req.on('end', () => { body = body.replace(/-.+-/g, '').replace(/WebKit.+|Contentdata.+|Content-Type.+/g, ''); fs.writeFile('test.png', body, (err) => { if (err)