Skip to content

Commit 5e317c7

Browse files
committed
cleanup unused splitBuffer method
1 parent 0ae61fe commit 5e317c7

File tree

2 files changed

+1
-30
lines changed

2 files changed

+1
-30
lines changed

src/model/events/body-formatting.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { styled } from '../../styles';
33

44
import { ViewableContentType } from '../events/content-types';
55
import { ObservablePromise, observablePromise } from '../../util/observable';
6-
import { bufferToString, bufferToHex, splitBuffer } from '../../util/buffer';
6+
import { bufferToString, bufferToHex } from '../../util/buffer';
77

88
import type { WorkerFormatterKey } from '../../services/ui-worker-formatters';
99
import { formatBufferAsync } from '../../services/ui-worker-api';

src/util/buffer.ts

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -150,32 +150,3 @@ export function getReadableSize(input: number | Buffer | string, siUnits = true)
150150

151151
return (bytes / Math.pow(thresh, unitIndex)).toFixed(1).replace(/\.0$/, '') + ' ' + unitName;
152152
}
153-
154-
/**
155-
* Splits a Buffer into an array of Buffers using a specified separator.
156-
* @param buffer The Buffer to split.
157-
* @param separator The byte or Buffer sequence to split by.
158-
* @returns An array of Buffers.
159-
*/
160-
export function splitBuffer(buffer: Buffer, separator: number | Buffer): Buffer[] {
161-
const result: Buffer[] = [];
162-
let currentOffset = 0;
163-
let separatorIndex: number;
164-
165-
// Handle single byte separator vs. multi-byte separator
166-
const separatorLength = typeof separator === 'number' ? 1 : separator.length;
167-
168-
while ((separatorIndex = buffer.indexOf(separator, currentOffset)) !== -1) {
169-
// Add the chunk before the separator
170-
result.push(buffer.slice(currentOffset, separatorIndex));
171-
// Move the offset past the separator
172-
currentOffset = separatorIndex + separatorLength;
173-
}
174-
175-
// Add the last chunk (or the whole buffer if no separator was found)
176-
if (currentOffset <= buffer.length) {
177-
result.push(buffer.slice(currentOffset));
178-
}
179-
180-
return result;
181-
}

0 commit comments

Comments
 (0)