UNPKG

394 BJavaScriptView Raw
1const https = require('https')
2const { URL } = require('url')
3module.exports = (urlString) => {
4 const { host, port, pathname } = new URL(urlString)
5 return new Promise((resolve, reject) => {
6 const options = {
7 host,
8 port,
9 path: pathname,
10 method: 'HEAD'
11 }
12 const req = https.request(options, (res) => {
13 resolve(res.headers)
14 })
15 req.end()
16 })
17}