Skip to main content
get - node__https.d.ts - Node documentation
function get

Usage in Deno

```typescript import { get } from "node:node__https.d.ts"; ```
get(
options:
RequestOptions
| string
| URL
,
callback?: (res: http.IncomingMessage) => void,
): http.ClientRequest
Like `http.get()` but for HTTPS. `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. ```js import https from '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); }); ```

Parameters

options:
RequestOptions
| string
| URL
Accepts the same `options` as [request](../.././node__https.d.ts/~/request), with the `method` always set to `GET`.
optional
callback: (res: http.IncomingMessage) => void

Return Type

http.ClientRequest
get(
url: string | URL,
options: RequestOptions,
callback?: (res: http.IncomingMessage) => void,
): http.ClientRequest

Parameters

url: string | URL
options: RequestOptions
optional
callback: (res: http.IncomingMessage) => void

Return Type

http.ClientRequest