Supported Formats

August 6, 2026 · View on GitHub

The server processes a wide range of file formats through a pipeline architecture. Each content type is routed to a specialized pipeline that extracts text, preserves structure, and produces searchable chunks.

Pipeline Routing

Content is routed to the first pipeline whose canProcess() method matches the MIME type. Pipelines are evaluated in this order:

PriorityPipelinePurposeOutput
1JsonPipelineJSON documentsJSON (structural splitting)
2SourceCodePipelineProgramming languagesSource code (AST-aware or line-based splitting)
3DocumentPipelineBinary and rich documentsMarkdown (converted via Xberg)
4HtmlPipelineWeb pagesMarkdown (converted via middleware chain)
5MarkdownPipelineMarkdown filesMarkdown (passthrough with metadata extraction)
6TextPipelineUniversal fallbackPlain text (line-based splitting)

Code Reference:

  • src/scraper/pipelines/PipelineFactory.ts - Pipeline ordering and selection
  • src/utils/mimeTypeUtils.ts - MIME type classification functions

Archives

Archive files are treated as content sources, not as a file format to extract text from. When the server encounters an archive, it unpacks the contents and processes each file individually through the appropriate pipeline.

Archives are supported as input for both local file scraping (file:// URLs) and web scraping (when an archive URL is the scrape target).

FormatExtensionsLibrary
ZIP.zipyauzl
TAR.tartar
Gzipped TAR.tar.gz, .tgztar

Code Reference:

  • src/utils/archive/ZipAdapter.ts - ZIP extraction
  • src/utils/archive/TarAdapter.ts - TAR/gzip extraction
  • src/utils/archive/ArchiveFactory.ts - Format detection (extension-based)
  • src/scraper/strategies/LocalFileStrategy.ts - Archive entry enumeration and processing

Documents

The DocumentPipeline uses Xberg (@xberg-io/xberg) to extract content from binary and rich document formats. All documents are converted to Markdown. Xberg's Markdown renderer emits the full document structure — for spreadsheets, each sheet appears as a heading followed by a Markdown table — so the rendered content is used directly; per-table Markdown serves only as a fallback when the rendered content is empty.

Documents are subject to a configurable size limit (scraper.document.maxSize, default 10 MB).

FormatExtensionsMIME Type
PDF.pdfapplication/pdf
Word (modern).docxapplication/vnd.openxmlformats-officedocument.wordprocessingml.document
Word (legacy).docapplication/msword
Excel (modern).xlsxapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Excel (legacy).xlsapplication/vnd.ms-excel
PowerPoint (modern).pptxapplication/vnd.openxmlformats-officedocument.presentationml.presentation
PowerPoint (legacy).pptapplication/vnd.ms-powerpoint
OpenDocument Text.odtapplication/vnd.oasis.opendocument.text
OpenDocument Spreadsheet.odsapplication/vnd.oasis.opendocument.spreadsheet
OpenDocument Presentation.odpapplication/vnd.oasis.opendocument.presentation
Rich Text Format.rtfapplication/rtf, text/rtf
EPUB.epubapplication/epub+zip
FictionBook.fb2application/x-fictionbook+xml
Jupyter Notebook.ipynbapplication/x-ipynb+json

Code Reference:

  • src/scraper/pipelines/DocumentPipeline.ts - Xberg integration and content extraction
  • src/utils/mimeTypeUtils.ts - isSupportedDocument() gate function

Web Pages

The HtmlPipeline converts HTML to Markdown through a multi-stage middleware chain: optional Playwright rendering for JavaScript-heavy pages, DOM parsing, metadata extraction, link discovery, content sanitization, URL normalization, and Markdown conversion.

FormatExtensionsMIME Type
HTML.html, .htmtext/html
XHTML.xhtmlapplication/xhtml+xml

Code Reference: src/scraper/pipelines/HtmlPipeline.ts

Markdown

The MarkdownPipeline processes Markdown files with frontmatter and metadata extraction. Content passes through to the semantic splitter with minimal transformation.

FormatExtensionsMIME Type
Markdown.md, .markdown, .mkd, .mkdn, .mkdown, .mdown, .mdwn, .ronn, .gfmtext/markdown, text/x-markdown, text/x-gfm
MDX.mdxtext/mdx

Code Reference: src/scraper/pipelines/MarkdownPipeline.ts

JSON

The JsonPipeline validates JSON structure and applies hierarchical splitting that preserves object and array boundaries for context-aware chunking.

FormatExtensionsMIME Type
JSON.jsonapplication/json, text/json, text/x-json

Code Reference: src/scraper/pipelines/JsonPipeline.ts

Source Code

The SourceCodePipeline handles programming languages with language detection. TypeScript, JavaScript, and Python use full tree-sitter AST parsing for structure-aware splitting. All other languages use line-based splitting.

Languages with AST-Aware Splitting

These languages use tree-sitter for semantic boundary detection (function, class, and module boundaries):

LanguageExtensions
TypeScript.ts, .mts, .cts
TSX.tsx
JavaScript.js, .cjs, .mjs
JSX.jsx
Python.py, .pyw, .pyi

Languages with Line-Based Splitting

These languages are recognized and processed with line-based splitting:

CategoryLanguagesExtensions
SystemsC.c, .h
C++.cpp, .cxx, .cc, .hpp, .hxx
Go.go
Rust.rs
Zig.zig
Nim.nim
V.v
Crystal.cr
JVMJava.java
Kotlin.kt, .kts
Scala.scala
Groovy.groovy, .gradle
.NETC#.cs
Apple/MobileSwift.swift
Dart.dart
ScriptingRuby.rb, .rake
PHP.php
Lua.lua
Perl.pl, .pm
R.r
Cython.pyx, .pxd
FunctionalHaskell.hs, .lhs
Elm.elm
Erlang.erl
Elixir.ex, .exs
Clojure.clj, .cljs, .cljc
Julia.jl
ShellBash.sh, .bash, .zsh, .fish
PowerShell.ps1
Web FrameworksVue.vue
Svelte.svelte
Astro.astro
StylesheetsCSS.css
SCSS.scss
Sass.sass
Less.less
Web3Solidity.sol
Move.move
Cairo.cairo

Code Reference:

  • src/scraper/pipelines/SourceCodePipeline.ts - Language detection and splitting
  • src/utils/mimeTypeUtils.ts - extractLanguageFromMimeType() mapping

Markup and Documentation Formats

These lightweight markup languages are processed as source code (line-based splitting), not as Markdown:

FormatExtensions
reStructuredText.rst
AsciiDoc.adoc, .asciidoc
Org Mode.org
Textile.textile
Pod.pod
RDoc.rdoc
Wiki.wiki
R Markdown.rmd

Configuration and Data Formats

These formats are processed as source code with language detection:

CategoryFormatExtensions
ConfigTOML.toml
INI.ini, .cfg
General config.conf
Properties.properties
Dotenv.env
Build SystemsDockerfile.dockerfile, .containerfile
Makefile.makefile
CMake.cmake
Bazel.bazel, .bzl
Buck.buck
IaCTerraform.tf, .tfvars
HCL.hcl
Data/QuerySQL.sql
GraphQL.graphql, .gql
XML.xml
YAML.yaml, .yml
Schema/APIProtocol Buffers.proto
Prisma.prisma
Thrift.thrift
Avro.avro
TeXTeX.tex
LaTeX.latex

Text Fallback

The TextPipeline acts as a universal fallback for any text/* MIME type not claimed by a higher-priority pipeline. It rejects binary content via null-byte detection.

Common formats handled by the text fallback:

FormatExtensions
Plain text.txt
CSV.csv
TSV.tsv
Log files.log

MIME Type Detection

File format detection uses a layered approach:

  1. HTTP Content-Type header (for web content)
  2. detectMimeTypeFromPath() - Extension-based detection using the mime package supplemented with custom mappings for formats the mime package misidentifies (e.g., .ts files detected as MPEG-2 transport streams)
  3. Content sniffing - Binary detection via null-byte scanning

URL query parameters and hash fragments are stripped before extension detection, so report.pdf?token=abc correctly resolves to application/pdf.

MIME Type Normalization

Some external MIME types (from HTTP headers or OS detection) are automatically corrected:

External MIME TypeCorrected ToReason
video/mp2ttext/x-typescript.ts / .mts MPEG-2 conflict
application/nodetext/javascript.cjs files
application/rls-services+xmltext/x-rust.rs files
application/vnd.lotus-organizertext/x-org.org files
application/vnd.darttext/x-dart.dart files
application/x-perltext/x-perl.pl / .pm files
application/x-textext/x-tex.tex files
application/x-latextext/x-latex.latex files
application/tomltext/x-toml.toml files

Code Reference: src/utils/mimeTypeUtils.ts - normalizeMimeType() and detectMimeTypeFromPath()