8000 fix: use more node: protocol imports by dnalborczyk · Pull Request #1428 · node-fetch/node-fetch · GitHub
[go: up one dir, main page]

Skip to content

fix: use more node: protocol imports #1428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 28, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
use node: protocol in readme
  • Loading branch information
dnalborczyk committed Dec 23, 2021
commit 214189f8420dda404df838ca47317eb8f5946ba2
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,9 @@ Cookies are not stored by default. However, cookies can be extracted and passed
The "Node.js way" is to use streams when possible. You can pipe `res.body` to another stream. This example uses [stream.pipeline](https://nodejs.org/api/stream.html#stream_stream_pipeline_streams_callback) to attach stream error handlers and wait for the download to complete.

```js
import {createWriteStream} from 'fs';
import {pipeline} from 'stream';
import {promisify} from 'util'
import {createWriteStream} from 'node:fs';
import {pipeline} from 'node:stream';
import {promisify} from 'node:util'
import fetch from 'node-fetch';

const streamPipeline = promisify(pipeline);
Expand Down Expand Up @@ -517,8 +517,8 @@ See [`http.Agent`](https://nodejs.org/api/http.html#http_new_agent_options) for
In addition, the `agent` option accepts a function that returns `http`(s)`.Agent` instance given current [URL](https://nodejs.org/api/url.html), this is useful during a redirection chain across HTTP and HTTPS protocol.

```js
import http from 'http';
import https from 'https';
import http from 'node:http';
import https from 'node:https';

const httpAgent = new http.Agent({
keepAlive: true
Expand Down
0