compare-with-file

v1.1.0
compare a string with the contents of a file

compare-with-file

Build Status v1.1.0

Compare the contents of a file with a string.

import { fileMatches } from 'compare-with-file';

fileMatches(filePath, 'expected contents'); // returns Boolean

To view a diff when the files don't match, use setLogging.

import { fileMatches, setLogging } from 'compare-with-file';
setLogging(true);

example output

- expected
+ actual

-   Th   is is the input file.\n
  "+-|+++-|---------------------"
+  w hoop s
npm i compare-with-file

Metadata

  • ISC
  • Whatever
  • Jeremy Greer
  • released 7/27/2016

Downloads

Maintainers