Skip to main content

Mapping: File Difference

Compare two text files line by line and produce a diff file. The comparison is textual: any text-based files (JSONL, CSV, Markdown, etc.) can be compared.

Input

Old filerequired

The reference version. Accepts a File or a JSON value (the JSON is serialized to a file before comparing).

New filerequired

The updated version to compare against the old file. Accepts a File or a JSON value.

Parameters

Output formatrequired

How the diff between the two files is serialized:

  • Patch (3 lines of context): standard unified diff (diff.patch) with 3 lines of context around each change.
  • Patch (full file): unified diff (diff.patch) with unlimited context — a single hunk spanning the entire file.
  • Line per change (jsonl): JSONL file (diff.jsonl) with one record per line of either file: {"tag": "similar" | "delete" | "insert", "value": …, "old_line": …, "new_line": …}. Unchanged lines are included with the similar tag; line numbers are 1-based and null on the side where the line does not exist.

Output

Diff file

Generated diff — diff.patch for the two patch formats, diff.jsonl for the line-per-change format. Patch headers reference the input file names.