MCPcopy Index your code
hub / github.com/ColmapView/Colmapview.github.io / buildReadableFile

Function buildReadableFile

src/test/builders/fileFakes.ts:456–475  ·  view source on GitHub ↗
({
  name = 'file.txt',
  contents = '',
  type = 'text/plain',
}: ReadableFileBuilderOptions = {})

Source from the content-addressed store, hash-verified

454};
455
456export function buildReadableFile({
457 name = 'file.txt',
458 contents = '',
459 type = 'text/plain',
460}: ReadableFileBuilderOptions = {}): File {
461 const file = buildFile(name, contents, type);
462
463 Object.defineProperties(file, {
464 arrayBuffer: {
465 configurable: true,
466 value: () => Promise.resolve(encodeFileContents(contents)),
467 },
468 text: {
469 configurable: true,
470 value: () => Promise.resolve(contents),
471 },
472 });
473
474 return file;
475}
476
477export function buildTextFile(name: string, contents: string): File {
478 return buildReadableFile({ name, contents, type: 'text/plain' });

Callers 5

buildTextFileFunction · 0.85
buildBinaryFileFunction · 0.85
builders.test.tsFile · 0.85

Calls 3

buildFileFunction · 0.90
encodeFileContentsFunction · 0.85
resolveMethod · 0.65

Tested by

no test coverage detected