Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pfrazee/published-working-tree
Read file-trees from disk and compare against a published tree
https://github.com/pfrazee/published-working-tree
Last synced: 11 days ago
JSON representation
Read file-trees from disk and compare against a published tree
- Host: GitHub
- URL: https://github.com/pfrazee/published-working-tree
- Owner: pfrazee
- Created: 2015-08-20T20:04:45.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-08-23T03:47:10.000Z (over 9 years ago)
- Last Synced: 2024-11-30T11:41:38.910Z (29 days ago)
- Language: JavaScript
- Size: 117 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Published Working Tree
Read file-trees from disk and compare against a published tree.
Used in [Patchwork](https://github.com/ssbc/patchwork) to drive publishing interfaces.## Usage
```js
var pwt = require('published-working-tree')// symbols used in tree to refer to non-file attributes
pwt.TYPE // 'directory' or 'file'
pwt.STAT // fs.Stat
pwt.NAME // String
pwt.PATH // Path
pwt.PUBLISHED // Boolean
pwt.MODIFIED // Boolean
pwt.DELETED // Boolean
pwt.ACTIVE // Boolean
pwt.DIRREAD // Boolean// load working tree from disk, compared against a published tree
pwt.loadworking(rootpath, publishedTree, function (err, workingTree) {
// ...
})// read all of the directory tree, without a published tree to compare against
var working = {}
pwt.readall (filepath, working, function () {
// ...
})// read just one directory
var working = {}
pwt.read (filepath, working, true, function () {
// ...
})// enumerate modifications to be published
pwt.changes (working)
// => { adds: [..], dels: [..], mods: [..] }// get change-state of item
pwt.change (item)
// => 'mod', 'add', or 'del'
```