# fsnap

> Snapshot and compare the target directory.

Latest version **1.2.1** (published 2017-04-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install fsnap
pnpm add fsnap
yarn add fsnap
bun add fsnap
```

## 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.2.1 |
| Published | 2017-04-06 |
| First published | 2017-04-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | jwu |
| Maintainers | johnnywu |
| Keywords | node, path |

## Links

- npm: https://www.npmjs.com/package/fsnap
- Repository: https://github.com/electron-utils/fsnap
- Issues: http://github.com/electron-utils/fsnap/issues
- npm.io page: https://npm.io/package/fsnap

## Dependencies (2)

- [globby](https://npm.io/package/globby.md) ^6.1.0
- [path-plus](https://npm.io/package/path-plus.md) ^1.0.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.2.1 (latest) — 2017-04-06
- 1.1.0 — 2017-04-03
- 1.0.0 — 2017-04-02

## README

# fsnap

[![Linux Build Status](https://travis-ci.org/electron-utils/fsnap.svg?branch=master)](https://travis-ci.org/electron-utils/fsnap)
[![Windows Build status](https://ci.appveyor.com/api/projects/status/0ebl8wdrt9wwmhcp?svg=true)](https://ci.appveyor.com/project/jwu/fsnap)
[![Dependency Status](https://david-dm.org/electron-utils/fsnap.svg)](https://david-dm.org/electron-utils/fsnap)
[![devDependency Status](https://david-dm.org/electron-utils/fsnap/dev-status.svg)](https://david-dm.org/electron-utils/fsnap#info=devDependencies)

Diff filesystem snapshot results. Useful for file watch system.

## Install

```bash
npm install --save fsnap
```

## Usage

```javascript
const fsnap = require('fsnap');

let s1 = fsnap.create(path);
let s2 = fsnap.create(path);
let result = fsnap.diff(s1, s2);

// do something...
console.log(result.deletes);
console.log(result.changes);
console.log(result.creates);
```

## API Reference

## Methods

### fsnap.create(patterns, [options])

  - `patterns` string|Array - See supported `minimatch` [patterns](https://github.com/isaacs/minimatch#usage).
  - `options` object - See the `node-glob` [options](https://github.com/isaacs/node-glob#options).

create snapshot from the given patterns.

### fsnap.diff(s1, s2)

  - `s1` object - snapshot 1
  - `s2` object - snapshot 2

Returns `object`

  - `deletes` array - path list of deleted files and directories.
  - `creates` array - path list of created files and directories.
  - `chagnes` array - path list of changed files and directories.

### fsnap.simplify(result)

  - `result` object - the result of `fsnap.diff`

Simplify the diff result by remove files contains in the directory in the same result.

## License

MIT © 2017 Johnny Wu

---
_Source: https://npm.io/package/fsnap · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
