prostore.glob-utils
Advanced tools
Comparing version 0.0.4 to 0.0.5
{ | ||
"name": "prostore.glob-utils", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Glob Utilities", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -1,18 +0,9 @@ | ||
#Index | ||
# ProStore Glob Utilities | ||
**Modules** | ||
Glob utils are used to lookup and compare file trees. | ||
* [prostore.glob-utils](#prostore.module_glob-utils) | ||
* [glob-utils.diff(src, dst)](#prostore.module_glob-utils.diff) | ||
## Usage | ||
**Typedefs** | ||
List files in `base/directory`: | ||
* [type: GlobFile](#GlobFile) | ||
<a name="prostore.module_glob-utils"></a> | ||
#prostore.glob-utils | ||
Lookup files in `cwd` directory matching glob `pattern`. | ||
Usage: | ||
```js | ||
@@ -22,29 +13,9 @@ var glob = require('prostore.glob-utils'); | ||
glob('base/directory', 'glob/pattern/*', function(err, files) { | ||
// ... | ||
// [ { path: 'rel/path/file1', mtime: 123456, md5: 'efcd...' }, ...] | ||
}); | ||
``` | ||
Dot-files (i.e. starting with dot) are not returned as per `glob` module. | ||
Directories are not returned either. | ||
Compare files: | ||
**Params** | ||
- cwd `string` - (current work directory) a directory where lookup is | ||
performed; this path is also stripped from resulting file paths. | ||
- pattern `string` - glob pattern | ||
- cb `function` - callback `function(err, files)`, | ||
where `files` is an array of [GlobFile](#GlobFile) | ||
<a name="prostore.module_glob-utils.diff"></a> | ||
##glob-utils.diff(src, dst) | ||
Compares two lists of file descriptors yielding four arrays: | ||
* `added` — files existing in `src` but missing in `dst` | ||
* `removed` — files existing in `dst` but missing in `src` | ||
* `modified` — files existing in both `src` and `dst` but with different `md5` | ||
* `unmodified` — files with equal content in both `src` and `dst` | ||
Usage: | ||
``` | ||
```js | ||
var diff = glob.diff(oldFiles, newFiles); | ||
@@ -57,27 +28,2 @@ // diff.added | ||
**Params** | ||
- src <code>[Array.<GlobFile>](#GlobFile)</code> | ||
- dst <code>[Array.<GlobFile>](#GlobFile)</code> | ||
<a name="GlobFile"></a> | ||
#type: GlobFile | ||
File descriptor object. | ||
Example: | ||
```js | ||
{ | ||
path: 'path/to/file/relative/to/cwd', | ||
mtime: 1234567890, | ||
md5: 'd41d8cd98f00b204e9800998ecf8427e' | ||
} | ||
``` | ||
**Properties** | ||
- path `string` - path relative to `cwd` | ||
- mtime `number` - last modification timestamp | ||
- md5 `string` - md5 hash of file content | ||
**Type**: `object` | ||
See source docs for more info. |
@@ -72,3 +72,3 @@ 'use strict'; | ||
* | ||
* ``` | ||
* ```js | ||
* var diff = glob.diff(oldFiles, newFiles); | ||
@@ -75,0 +75,0 @@ * // diff.added |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
5114
4
139
28