diff options
| author | Abhi <[email protected]> | 2025-07-25 21:56:49 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-26 01:56:49 +0000 |
| commit | ca5dd28ab60d78f42150460cbe9d4ed58d40afe4 (patch) | |
| tree | 6f3b3b373133a6c0bf8bb9cee8a10cc06ac83c9a /packages/cli/src/ui/utils/textUtils.ts | |
| parent | ad2ef080aae2e21bf04ad8e922719ceaa81f1e5f (diff) | |
refactor(core): Centralize shell logic into ShellExecutionService (#4823)
Diffstat (limited to 'packages/cli/src/ui/utils/textUtils.ts')
| -rw-r--r-- | packages/cli/src/ui/utils/textUtils.ts | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/packages/cli/src/ui/utils/textUtils.ts b/packages/cli/src/ui/utils/textUtils.ts index fa0abe9a..e4d8ea58 100644 --- a/packages/cli/src/ui/utils/textUtils.ts +++ b/packages/cli/src/ui/utils/textUtils.ts @@ -17,35 +17,6 @@ export const getAsciiArtWidth = (asciiArt: string): number => { return Math.max(...lines.map((line) => line.length)); }; -/** - * Checks if a Buffer is likely binary by testing for the presence of a NULL byte. - * The presence of a NULL byte is a strong indicator that the data is not plain text. - * @param data The Buffer to check. - * @param sampleSize The number of bytes from the start of the buffer to test. - * @returns True if a NULL byte is found, false otherwise. - */ -export function isBinary( - data: Buffer | null | undefined, - sampleSize = 512, -): boolean { - if (!data) { - return false; - } - - const sample = data.length > sampleSize ? data.subarray(0, sampleSize) : data; - - for (const byte of sample) { - // The presence of a NULL byte (0x00) is one of the most reliable - // indicators of a binary file. Text files should not contain them. - if (byte === 0) { - return true; - } - } - - // If no NULL bytes were found in the sample, we assume it's text. - return false; -} - /* * ------------------------------------------------------------------------- * Unicode‑aware helpers (work at the code‑point level rather than UTF‑16 |
