Skip to content

Commit

Permalink
docs(core): Update docs for global fetch() availability in Node (#1534)
Browse files Browse the repository at this point in the history
  • Loading branch information
donmccurdy authored Oct 17, 2024
1 parent a5f837c commit 91943cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { URL } from 'url';
import { promises as fs, readFileSync } from 'fs';
import micromatch from 'micromatch';
import { gzip } from 'node-gzip';
import fetch from 'node-fetch';
import fetch from 'node-fetch'; // TODO(deps): Replace when v20 reaches end of maintenance.
import mikktspace from 'mikktspace';
import { MeshoptEncoder, MeshoptSimplifier } from 'meshoptimizer';
import { ready as resampleReady, resample as resampleWASM } from 'keyframe-resample';
Expand Down
5 changes: 2 additions & 3 deletions packages/core/src/io/node-io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@ import { HTTPUtils } from '../utils/index.js';
* ```
*
* By default, NodeIO can only read/write paths on disk. To enable network requests, provide a Fetch
* API implementation (such as [`node-fetch`](https://www.npmjs.com/package/node-fetch)) and enable
* API implementation (global [`fetch()`](https://nodejs.org/api/globals.html#fetch) is stable in
* Node.js v21+, or [`node-fetch`](https://www.npmjs.com/package/node-fetch) may be installed) and enable
* {@link NodeIO.setAllowNetwork setAllowNetwork}. Network requests may optionally be configured with
* [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/fetch#parameters) parameters.
*
* ```typescript
* import fetch from 'node-fetch';
*
* const io = new NodeIO(fetch, {headers: {...}}).setAllowNetwork(true);
*
* const document = await io.read('https://example.com/path/to/model.glb');
Expand Down

0 comments on commit 91943cb

Please sign in to comment.