Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@beaker/dat-archive-file-diff

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@beaker/dat-archive-file-diff

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

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

dat-archive-file-diff

Get line-by-line diffs of text files in Dat archives. Basically a thin wrapper around jsdiff.

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.

Keywords

FAQs

Package last updated on 14 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc