No description
Find a file
2025-09-01 03:21:54 +03:00
.vscode init 2025-09-01 03:21:54 +03:00
source/sdiff init 2025-09-01 03:21:54 +03:00
.gitignore init 2025-09-01 03:21:54 +03:00
dub.json init 2025-09-01 03:21:54 +03:00
dub.selections.json init 2025-09-01 03:21:54 +03:00
LICENSE init 2025-09-01 03:21:54 +03:00
README.md init 2025-09-01 03:21:54 +03:00

Simply Diff

A minimal D wrapper over xdiff.d for computing file differences and generating patches.

Features

  • Create in-memory files (MMFile) from strings, string arrays, or raw bytes.
  • Compute diffs between two in-memory files.
  • Collect results as MMBlocks, convertible to a string or byte slice.

Installation

Add to dub.json:

{
	"dependencies": {
		"sdiff": "~>0.1.0"
	}
}

Or

{
	"dependencies": {
		"sdiff": {
			"repository": "git+https://git.zhirov.kz/dlang/sdiff.git",
			"version": "<hash from git>"
		}
	}
}

Run dub build.

Example

import sdiff;
import std.stdio : writeln;

void main()
{
	auto a = new MMFile("hello world\n");
	auto b = new MMFile("hello world!\n");

	auto patch = a.diff(b);

	writeln(patch);
}

Output:

@@ -1,1 +1,1 @@
-hello world
+hello world!

License

Boost Software License 1.0. See LICENSE.