Socket
Socket
Sign inDemoInstall

prostore.glob-utils

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prostore.glob-utils - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

2

package.json
{
"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.&lt;GlobFile&gt;](#GlobFile)</code>
- dst <code>[Array.&lt;GlobFile&gt;](#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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc