Skip to content

Commit

Permalink
Merge pull request #37 from uncenter/drop-node-fetch
Browse files Browse the repository at this point in the history
Drop node-fetch and bump engines.node to >= 18
  • Loading branch information
zachleat authored May 13, 2024
2 parents f818d83 + 64f4275 commit 3f51ee2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
node: ["14", "16", "18"]
node: ["18", "20"]
name: Node.js ${{ matrix.node }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# eleventy-fetch

_Requires Node 14+_
_Requires Node 18+_

Formerly known as [`@11ty/eleventy-cache-assets`](https://www.npmjs.com/package/@11ty/eleventy-cache-assets).

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"eleventy-fetch.js"
],
"engines": {
"node": ">=14"
"node": ">=18"
},
"funding": {
"type": "opencollective",
Expand All @@ -45,7 +45,6 @@
"dependencies": {
"debug": "^4.3.4",
"flat-cache": "^3.0.4",
"node-fetch": "^2.6.7",
"p-queue": "^6.6.2"
},
"ava": {
Expand Down
3 changes: 1 addition & 2 deletions src/RemoteAssetCache.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const fs = require("fs");
const fsp = fs.promises; // Node 10+

const fetch = require("node-fetch");
const AssetCache = require("./AssetCache");
const debug = require("debug")("EleventyCacheAssets");

Expand Down Expand Up @@ -47,7 +46,7 @@ class RemoteAssetCache extends AssetCache {
} else if(type === "text") {
return response.text();
}
return response.buffer();
return Buffer.from(await response.arrayBuffer());
}

async fetch(optionsOverride = {}) {
Expand Down

0 comments on commit 3f51ee2

Please sign in to comment.