fix: replace usages of Buffer#slice() with Buffer#subarray() (#11326)

fix: replace usages of Buffer.slice() with Buffer.subarray()

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Almeida
2025-12-02 23:13:10 +00:00
committed by GitHub
parent ec7047572e
commit 87b359e44d
2 changed files with 2 additions and 2 deletions

View File

@@ -157,7 +157,7 @@ describe('VoiceReceiver', () => {
);
const expectedNonce = Buffer.concat([
XCHACHA20_SAMPLE.encrypted.slice(XCHACHA20_SAMPLE.encrypted.length - 4),
XCHACHA20_SAMPLE.encrypted.subarray(XCHACHA20_SAMPLE.encrypted.length - 4),
Buffer.alloc(20),
]);

View File

@@ -20,7 +20,7 @@ export interface SocketConfig {
export function parseLocalPacket(message: Buffer): SocketConfig {
const packet = Buffer.from(message);
const ip = packet.slice(8, packet.indexOf(0, 8)).toString('utf8');
const ip = packet.subarray(8, packet.indexOf(0, 8)).toString('utf8');
if (!isIPv4(ip)) {
throw new Error('Malformed IP address');