Send HEAD request in nodejs

nodejs head
const http = require('http');
http.request(url, { method: 'HEAD' }, (res) => {
  console.log(res.statusCode);
})
  .on('error', (err) => {
    console.error(err);
  })
  .end();