Answers for "npm in node"

0

using multiparty with node js express

var express = require('express');
var multiparty = require('connect-multiparty'),
    multipartyMiddleware = multiparty({ uploadDir: './imagesPath' });

var router = express.Router();

router.post('/', multipartyMiddleware, function(req, res) {
  console.log(req.body, req.files);
  var file = req.files.file;
  console.log(file.name);
  console.log(file.type);
  res.status(200).send('OK');
});

module.exports = router;
Posted by: Guest on May-05-2020
0

writefile in node js

// append_file.js

const fs = require('fs');

// add a line to a lyric file, using appendFile
fs.appendFile('empirestate.txt', '\nRight there up on Broadway', (err) => {
    if (err) throw err;
    console.log('The lyrics were updated!');
});
Posted by: Guest on March-15-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language