https.get(url[, options][, callback])
- 
options<Object> | <string> | <URL> 接受与https.request()相同的options,方法默认设置为 GET。¥
options<Object> | <string> | <URL> Accepts the sameoptionsashttps.request(), with the method set to GET by default. - 
callback<Function> - 
¥Returns: <http.ClientRequest>
 
类似于 http.get(),但用于 HTTPS。
¥Like http.get() but for HTTPS.
options 可以是对象、字符串或 URL 对象。如果 options 是字符串,则会自动使用 new URL() 解析。如果是 URL 对象,则会自动转换为普通的 options 对象。
¥options can be an object, a string, or a URL object. If options is a
string, it is automatically parsed with new URL(). If it is a URL
object, it will be automatically converted to an ordinary options object.
import { get } from 'node:https';
import process from 'node:process';
get('https://encrypted.google.com/', (res) => {
  console.log('statusCode:', res.statusCode);
  console.log('headers:', res.headers);
  res.on('data', (d) => {
    process.stdout.write(d);
  });
}).on('error', (e) => {
  console.error(e);
});const https = require('node:https');
https.get('https://encrypted.google.com/', (res) => {
  console.log('statusCode:', res.statusCode);
  console.log('headers:', res.headers);
  res.on('data', (d) => {
    process.stdout.write(d);
  });
}).on('error', (e) => {
  console.error(e);
});