@umbranoxio/difflux
v0.1.0
Published
A TypeScript library for decompiling and diffing .NET assemblies using ILSpy
Downloads
4
Maintainers
Readme
@umbranoxio/difflux
A TypeScript library for decompiling and diffing .NET assemblies using ILSpy.
How it works
This package works by bootstrapping the .NET 6.0 SDK into your node_modules, installs ilspycmd and uses it to decompile
For security reasons, whatever assembly is passed to this package is secured by adding a random extension to the file name, and on unix systems, the file is made non executable.
Note: This package has only been tested on apple silicon. Raise an issue if you have any problems on other platforms.
Installation
Install using npm:
npm install @umbranoxio/diffluxOr using pnpm:
pnpm add @umbranoxio/diffluxUsage
Basic Decompilation
Decompile a single assembly:
import { decompile } from '@umbranoxio/difflux';
await decompile({ assemblyPath: './path/to/assembly.dll' }, './output/directory');Decompiling with Dependencies
If your assembly references external libraries, provide the path to those dependencies:
All assemblies accociated with the assembly must be in the root of the
dependenciesPath
import { diffDecompiledAssemblies } from '@umbranoxio/difflux';
await decompile(
{
assemblyPath: './path/to/assembly.dll',
dependenciesPath: './path/to/dependencies',
},
'./output/directory'
);Comparing Two Assemblies
Generate a diff between two assemblies:
import { diffDecompiledAssemblies } from '@umbranoxio/difflux';
const result = await diffDecompiledAssemblies(
{ assemblyPath: './path/to/first.dll' },
{ assemblyPath: './path/to/second.dll' },
{ outputPath: './diff/output' } // Optional
);
console.log(result.diff); // View the unified diff
console.log(result.firstSource); // Original decompiled source
console.log(result.secondSource); // Modified decompiled sourceComparing Two Assemblies with dependencies
All assemblies accociated with the assembly must be in the root of the
dependenciesPath
import { diffDecompiledAssemblies } from '@umbranoxio/difflux';
const result = await diffDecompiledAssemblies(
{
assemblyPath: './path/to/first.dll',
dependenciesPath: './path/to/first/dependencies',
},
{
assemblyPath: './path/to/second.dll',
dependenciesPath: './path/to/second/dependencies',
},
{ outputPath: './diff/output' } // Optional
);
console.log(result.diff); // View the unified diff
console.log(result.firstSource); // Original decompiled source
console.log(result.secondSource); // Modified decompiled sourceRequirements
- Node.js
- Internet connection (for initial .NET SDK download)
License
MIT
