MCPcopy Create free account
hub / github.com/WJX20/claude-code / bytesPerTokenForFileType

Function bytesPerTokenForFileType

src/services/tokenEstimation.ts:215–224  ·  view source on GitHub ↗
(fileExtension: string)

Source from the content-addressed store, hash-verified

213 * which makes the real ratio closer to 2 rather than the default 4.
214 */
215export function bytesPerTokenForFileType(fileExtension: string): number {
216 switch (fileExtension) {
217 case 'json':
218 case 'jsonl':
219 case 'jsonc':
220 return 2
221 default:
222 return 4
223 }
224}
225
226/**
227 * Like {@link roughTokenCountEstimation} but uses a more accurate

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected