mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-05-12 06:21:30 +00:00
Fix buffer-equal-constant-time for Node.js v25+ compatibility
This commit is contained in:
parent
47457ee1e7
commit
30b40c3c7a
1 changed files with 8 additions and 3 deletions
|
|
@ -28,14 +28,19 @@ 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);
|
||||
};
|
||||
if (SlowBuffer && SlowBuffer.prototype) {
|
||||
SlowBuffer.prototype.equal = Buffer.prototype.equal;
|
||||
}
|
||||
};
|
||||
|
||||
var origBufEqual = Buffer.prototype.equal;
|
||||
var origSlowBufEqual = SlowBuffer.prototype.equal;
|
||||
var origSlowBufEqual = SlowBuffer && SlowBuffer.prototype ? SlowBuffer.prototype.equal : undefined;
|
||||
bufferEq.restore = function () {
|
||||
Buffer.prototype.equal = origBufEqual;
|
||||
SlowBuffer.prototype.equal = origSlowBufEqual;
|
||||
if (SlowBuffer && SlowBuffer.prototype) {
|
||||
SlowBuffer.prototype.equal = origSlowBufEqual;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue