MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / isBinaryPath

Function isBinaryPath

src/utils/binaryExtensions.js:346–361  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

344}
345
346export function isBinaryPath(file) {
347 const path = String(file ?? "").split(/[?#]/)[0];
348 const basename = path.split(/[\\/]/).pop()?.toLowerCase() || "";
349
350 const lastDot = basename.lastIndexOf(".");
351 if (lastDot === -1) return false;
352
353 const singleExtension = basename.slice(lastDot + 1);
354 if (binaryExtensionSet.has(singleExtension)) return true;
355
356 const previousDot = basename.lastIndexOf(".", lastDot - 1);
357 if (previousDot === -1) return false;
358
359 const compoundExtension = basename.slice(previousDot + 1);
360 return binaryExtensionSet.has(compoundExtension);
361}
362
363export function isBinaryMime(mime) {
364 const normalized = normalizeMime(mime);

Callers 1

isBinaryFileFunction · 0.85

Calls 1

StringInterface · 0.85

Tested by

no test coverage detected