Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

action-walk

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

action-walk - npm Package Compare versions

Comparing version 2.1.1 to 2.2.0

5

action-walk.js

@@ -16,2 +16,3 @@ const fsp = require('fs').promises;

}
const stack = [];

@@ -35,2 +36,3 @@ if (options.fileAction) {

async function walker (dir) {
stack.push(path.basename(dir));
for await (const dirent of await fsp.opendir(dir)) {

@@ -42,3 +44,3 @@ let entry = path.join(dir, dirent.name);

}
const ctx = {dirent};
const ctx = {dirent, stack};
if (options.own) {

@@ -66,2 +68,3 @@ ctx.own = options.own;

}
stack.pop();
return undefined;

@@ -68,0 +71,0 @@ }

2

package.json
{
"name": "action-walk",
"version": "2.1.1",
"version": "2.2.0",
"description": "walk a directory tree performing actions",

@@ -5,0 +5,0 @@ "main": "action-walk.js",

@@ -47,11 +47,12 @@ # action-walk

await walk('.', options);
walk('.', options)
.then(() => {
console.log('total bytes in "."', ctx.total);
});
console.log('total bytes in "."', ctx.total);
// executed in the await-walk package root it will print something like
// executed in the action-walk package root it will print something like
// total bytes in "." 14778
```
see `test/basics.test.js` for another example.
see `test/basics.test.js` or `bin/walk.js` for other examples.

@@ -67,5 +68,5 @@ ### api

- `otherAction` - called when the entry is not a file, directory, or symbolic link.
- `stat` - if `lstat` call `fs.lstat` on the entry and add it to the action context. if
otherwise truthy use `fs.stat`.
- `own` - add this to the action context. it is context for the action functions.
- `stat` - if `'lstat'` call `fs.lstat` on the entry and add it to the action context's `stat`
property. if otherwise truthy use `fs.stat`.
- `own` - add this to the action context. it is your context for the action functions.

@@ -86,2 +87,3 @@ It's possible to call `walk()` with no options but probably not useful unless

stat, // if `options.stat` the object returned by `fs.stat` or `fs.lstat`
stack, // the stack of directories above the current dirent item.
own // `options.own` if provided.

@@ -88,0 +90,0 @@ }

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