# @beaker/dat-archive-file-diff

> Get line-by-line diffs of text files in Dat archives

Latest version **1.0.0** (published 2018-05-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @beaker/dat-archive-file-diff
pnpm add @beaker/dat-archive-file-diff
yarn add @beaker/dat-archive-file-diff
bun add @beaker/dat-archive-file-diff
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-05-14 |
| First published | 2018-05-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 3.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Paul Frazee |
| Maintainers | pfraze, taravancil |
| Keywords | dat, diff |

## Links

- npm: https://www.npmjs.com/package/@beaker/dat-archive-file-diff
- Repository: https://github.com/beakerbrowser/dat-archive-file-diff
- Homepage: https://github.com/beakerbrowser/dat-archive-file-diff#readme
- Issues: https://github.com/beakerbrowser/dat-archive-file-diff/issues
- npm.io page: https://npm.io/package/@beaker/dat-archive-file-diff

## Dependencies (4)

- [diff](https://npm.io/package/diff.md) ^3.5.0
- [textextensions](https://npm.io/package/textextensions.md) ^2.2.0
- [binary-extensions](https://npm.io/package/binary-extensions.md) ^1.11.0
- [beaker-error-constants](https://npm.io/package/beaker-error-constants.md) ^1.4.0

## Alternatives

- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@regle/core](https://npm.io/package/@regle/core.md) — 47.0K weekly downloads
- [typeof-arguments](https://npm.io/package/typeof-arguments.md) — 12.5K weekly downloads
- [@lokalise/projects-engine-contracts](https://npm.io/package/@lokalise/projects-engine-contracts.md) — 978 weekly downloads
- [@osjwnpm/nam-laboriosam-quibusdam](https://npm.io/package/@osjwnpm/nam-laboriosam-quibusdam.md) — 70 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-05-14

## README

# dat-archive-file-diff

Get line-by-line diffs of text files in Dat archives. Basically a thin wrapper around [jsdiff](https://github.com/kpdecker/jsdiff).

```js
const {diffLines} = require('dat-archive-file-diff')

var a = new DatArchive('...')
var b = new DatArchive('...')
var diff = await diffLines(a, '/foo.txt', b, '/foo.txt')
```

## API

### diffLines (leftArchive, leftPath, rightArchive, rightPath, options)

 - Options:
   - `ignoreWhitespace`: true to ignore leading and trailing whitespace.
   - `newlineIsToken`: true to treat newline characters as separate tokens. This allows for changes to the newline structure to occur independently of the line content and to be treated as such. In general this is the more human friendly form of diffLines and diffLines is better suited for patches and other computer friendly output.
 - Returns a list of change objects (See below).

### Change objects

Many of the methods above return change objects. These objects consist of the following fields:

 - `value`: Text content
 - `added`: True if the value was inserted into the new string
 - `removed`: True of the value was removed from the old string

Note that some cases may omit a particular flag field. Comparison on the flag fields should always be done in a truthy or falsy manner.

---
_Source: https://npm.io/package/@beaker/dat-archive-file-diff · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
