https://github.com/otbe/snapshot-dir
Takes a snapshot of a folder
https://github.com/otbe/snapshot-dir
Last synced: 4 months ago
JSON representation
Takes a snapshot of a folder
- Host: GitHub
- URL: https://github.com/otbe/snapshot-dir
- Owner: otbe
- License: mit
- Created: 2017-04-28T21:36:21.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-29T16:05:30.000Z (about 8 years ago)
- Last Synced: 2025-03-09T03:32:53.362Z (4 months ago)
- Language: TypeScript
- Size: 63.5 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# snapshot-dir
[](https://travis-ci.org/otbe/snapshot-dir)Every now and then I need a little tool which takes a snapshot of a folder and compares it to an older one. Imagine we program a build/bundler tool which uses this technqiue to ensure integrity after changes to the core.
*snapshot-dir* exports four functions to generate and compare snapshots.
## API
### snapshot
```
snapshot(path: string): Promise
```
Generates a snapshot from a given ```path```. The result is an object with filenames as keys and hashs as values.### snapshotCompare
```
snapshotCompare(path: string, currentSnap: SnapshotResult): Promise
```
Compares a given ```path``` with a given ```currentSnap``` and returns a [deep-diff](https://www.npmjs.com/package/deep-diff#simple-examples) result object, which is undefined for no diff or a changeset.### snapshotSync
Same as ```snapshot``` but sync.### snapshotCompareSync
Same as ```snapshotCompare``` but sync.