Files
cloudflare--workers-sdk/patches/buffer-equal-constant-time@1.0.1.patch
wehub-resource-sync 70bf21e064
Handle Changesets / Handle Changesets (push) Waiting to run
Semgrep OSS scan / semgrep-oss (push) Waiting to run
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
chore: import upstream snapshot with attribution
2026-07-13 12:30:11 +08:00

33 lines
1.1 KiB
Diff

diff --git a/.npmignore b/.npmignore
deleted file mode 100644
index 34e4f5c298de294fa5c1c1769b6489eb047bde9a..0000000000000000000000000000000000000000
diff --git a/index.js b/index.js
index 5462c1f830bdbe79bf2b1fcfd811cd9799b4dd11..05e654af7e9fc8c5db40a64c0923cd23bb803adc 100644
--- a/index.js
+++ b/index.js
@@ -28,14 +28,21 @@ function bufferEq(a, b) {
}
bufferEq.install = function() {
- Buffer.prototype.equal = SlowBuffer.prototype.equal = function equal(that) {
+ Buffer.prototype.equal = function equal(that) {
return bufferEq(this, that);
};
+ // SlowBuffer was removed in Node 25
+ if (SlowBuffer !== undefined) {
+ SlowBuffer.prototype.equal = Buffer.prototype.equal;
+ }
};
var origBufEqual = Buffer.prototype.equal;
-var origSlowBufEqual = SlowBuffer.prototype.equal;
+var origSlowBufEqual = SlowBuffer !== undefined ? SlowBuffer.prototype.equal : undefined;
bufferEq.restore = function() {
Buffer.prototype.equal = origBufEqual;
- SlowBuffer.prototype.equal = origSlowBufEqual;
+ // SlowBuffer was removed in Node 25
+ if (SlowBuffer !== undefined) {
+ SlowBuffer.prototype.equal = origSlowBufEqual;
+ }
};