Compare commits
61 Commits
prototypic
...
master
Author | SHA1 | Date |
---|---|---|
AJ ONeal | 7db92bab06 | |
AJ ONeal | b97c97941f | |
AJ ONeal | a55a943b22 | |
AJ ONeal | cbbd8f2743 | |
AJ ONeal | 6593caa2d8 | |
AJ ONeal | 38a7da0a6c | |
AJ ONeal | 280bfd28ae | |
AJ ONeal | 930ddb439b | |
AJ ONeal | 1e516c2a52 | |
wannabesrevenge | 7d943ef1f2 | |
AJ ONeal | b4b38f7520 | |
AJ ONeal | cccd13e0fc | |
AJ ONeal | 0978e93679 | |
AJ ONeal | 527cb82e9d | |
AJ ONeal | a72cd5e478 | |
AJ ONeal | 55af3327a6 | |
AJ ONeal | 1042205948 | |
AJ ONeal | 24d237ae74 | |
AJ ONeal | 767a684da1 | |
AJ ONeal | 0d6bda5385 | |
AJ ONeal | 01a28a0d2b | |
AJ ONeal | 06ccf5d52e | |
claflamme | 1b9032c638 | |
AJ ONeal | 53d7d4f345 | |
Steven Vachon | 2670ffd337 | |
AJ ONeal | cfca163597 | |
AJ ONeal | 65f572556a | |
AJ ONeal | 962f631b42 | |
AJ ONeal | a91f404fc7 | |
Mathieu Chateau | 1201577900 | |
Mathieu Chateau | 6b72860050 | |
AJ ONeal | 754f6bb9c4 | |
AJ ONeal | 908051c694 | |
Gregg Caines | 9e461cd9a5 | |
Gregg Caines | e79860e672 | |
AJ ONeal | 98b8f21ba9 | |
AJ ONeal | 5a5e0397d7 | |
AJ ONeal | 9102a54184 | |
AJ ONeal | 60ddf2a503 | |
AJ ONeal | 7d10ccfb6f | |
AJ ONeal | 3a5d395587 | |
AJ ONeal | ab6527a4c4 | |
AJ ONeal | 4dbe318a1c | |
AJ ONeal | 817e7dea56 | |
AJ ONeal | 8d1fda4cbc | |
AJ ONeal | 16f44f25fe | |
AJ ONeal | dad2e70092 | |
AJ ONeal | ec07897228 | |
Lars-Magnus Skog | 484489abf3 | |
AJ ONeal | 49e9260caa | |
ZECTBynmo | 863a196262 | |
ZECTBynmo | 85e84a0a3f | |
ZECTBynmo | 6c4e267bd1 | |
ZECTBynmo | 14063d8fc3 | |
ZECTBynmo | 142c66c411 | |
ZECTBynmo | 09ba753b80 | |
AJ ONeal | 42cdccff35 | |
David Murdoch | a58ea0d682 | |
AJ ONeal | a26de5a66c | |
AJ ONeal | ca3c95b022 | |
AJ ONeal | 8005996062 |
|
@ -0,0 +1,2 @@
|
|||
node_modules
|
||||
walk-test
|
|
@ -0,0 +1,14 @@
|
|||
{ "node": true
|
||||
, "browser": true
|
||||
, "jquery": true
|
||||
|
||||
, "onevar": true
|
||||
, "laxcomma": true
|
||||
, "laxbreak": true
|
||||
|
||||
, "eqeqeq": true
|
||||
, "immed": true
|
||||
, "undef": true
|
||||
, "unused": true
|
||||
, "latedef": true
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
Copyright 2011 AJ ONeal
|
||||
|
||||
This is open source software; you can redistribute it and/or modify it under the
|
||||
terms of either:
|
||||
|
||||
a) the "MIT License"
|
||||
b) the "Apache-2.0 License"
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
Apache-2.0 License Summary
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
202
LICENSE.APACHE2
202
LICENSE.APACHE2
|
@ -1,202 +0,0 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2011 AJ ONeal
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
|
@ -1,9 +0,0 @@
|
|||
MIT LICENSE
|
||||
|
||||
Copyright (c) 2011 AJ ONeal
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
323
README.md
323
README.md
|
@ -1,134 +1,272 @@
|
|||
node-walk
|
||||
====
|
||||
# 2021 Update
|
||||
|
||||
Consider using [`@root/walk`](https://npmjs.org/package/@root/walk) instead.
|
||||
|
||||
I created `walk` quite literally a decade ago, in the Node v0.x days.
|
||||
Back then using an EventEmitter seemed like the thing to do. Nowadays,
|
||||
it seems a bit overkill for the simple task of walking over directories.
|
||||
|
||||
There's nothing wrong with `walk` - it's about the same as it was 10 years ago -
|
||||
however, at only 50 lines of code long, `@root/walk` is much simpler and much faster.
|
||||
|
||||
# node-walk
|
||||
|
||||
| a [Root](https://rootprojects.org) project
|
||||
|
||||
nodejs walk implementation.
|
||||
|
||||
This is somewhat of a port python's `os.walk`, but using Node.JS conventions.
|
||||
|
||||
* EventEmitter
|
||||
* Asynchronous
|
||||
* Chronological (optionally)
|
||||
* Built-in flow-control
|
||||
* includes Synchronous version (same API as Asynchronous)
|
||||
- EventEmitter
|
||||
- Asynchronous
|
||||
- Chronological (optionally)
|
||||
- Built-in flow-control
|
||||
- includes Synchronous version (same API as Asynchronous)
|
||||
|
||||
As few file descriptors are opened at a time as possible.
|
||||
This is particularly well suited for single hard disks which are not flash or solid state.
|
||||
|
||||
Installation
|
||||
----
|
||||
## Installation
|
||||
|
||||
npm install walk
|
||||
```bash
|
||||
npm install --save walk
|
||||
```
|
||||
|
||||
Usage
|
||||
====
|
||||
# Getting Started
|
||||
|
||||
```javascript
|
||||
'use strict';
|
||||
|
||||
var walk = require('walk');
|
||||
var fs = require('fs');
|
||||
var walker;
|
||||
var options = {};
|
||||
|
||||
walker = walk.walk('/tmp', options);
|
||||
|
||||
walker.on('file', function (root, fileStats, next) {
|
||||
fs.readFile(fileStats.name, function () {
|
||||
// doStuff
|
||||
next();
|
||||
});
|
||||
});
|
||||
|
||||
walker.on('errors', function (root, nodeStatsArray, next) {
|
||||
next();
|
||||
});
|
||||
|
||||
walker.on('end', function () {
|
||||
console.log('all done');
|
||||
});
|
||||
```
|
||||
|
||||
## Common Events
|
||||
|
||||
All single event callbacks are in the form of `function (root, stat, next) {}`.
|
||||
|
||||
All multiple event callbacks callbacks are in the form of `function (root, stats, next) {}`, except **names** which is an array of strings.
|
||||
|
||||
All **error** event callbacks are in the form `function (root, stat/stats, next) {}`.
|
||||
**`stat.error`** contains the error.
|
||||
|
||||
- `names`
|
||||
- `directory`
|
||||
- `directories`
|
||||
- `file`
|
||||
- `files`
|
||||
- `end`
|
||||
- `nodeError` (`stat` failed)
|
||||
- `directoryError` (`stat` succedded, but `readdir` failed)
|
||||
- `errors` (a collection of any errors encountered)
|
||||
|
||||
A typical `stat` event looks like this:
|
||||
|
||||
```javascript
|
||||
{ dev: 16777223,
|
||||
mode: 33188,
|
||||
nlink: 1,
|
||||
uid: 501,
|
||||
gid: 20,
|
||||
rdev: 0,
|
||||
blksize: 4096,
|
||||
ino: 49868100,
|
||||
size: 5617,
|
||||
blocks: 16,
|
||||
atime: Mon Jan 05 2015 18:18:10 GMT-0700 (MST),
|
||||
mtime: Thu Sep 25 2014 21:21:28 GMT-0600 (MDT),
|
||||
ctime: Thu Sep 25 2014 21:21:28 GMT-0600 (MDT),
|
||||
birthtime: Thu Sep 25 2014 21:21:28 GMT-0600 (MDT),
|
||||
name: 'README.md',
|
||||
type: 'file' }
|
||||
```
|
||||
|
||||
# Advanced Example
|
||||
|
||||
Both Asynchronous and Synchronous versions are provided.
|
||||
|
||||
The Synchronous version still uses callbacks, so it is safe to use with other Asynchronous functions and will still work as expected.
|
||||
```javascript
|
||||
'use strict';
|
||||
|
||||
var walk = require('walk'),
|
||||
fs = require('fs'),
|
||||
options,
|
||||
walker;
|
||||
var walk = require('walk');
|
||||
var fs = require('fs');
|
||||
var options;
|
||||
var walker;
|
||||
|
||||
options = {
|
||||
followLinks: false,
|
||||
};
|
||||
options = {
|
||||
followLinks: false,
|
||||
// directories with these keys will be skipped
|
||||
filters: ['Temp', '_Temp'],
|
||||
};
|
||||
|
||||
walker = walk.walk("/tmp", options);
|
||||
walker = walk.walk('/tmp', options);
|
||||
|
||||
// OR
|
||||
// walker = walk.walkSync("/tmp", options);
|
||||
// OR
|
||||
// walker = walk.walkSync("/tmp", options);
|
||||
|
||||
walker.on("names", function (root, nodeNamesArray) {
|
||||
nodeNames.sort(function (a, b) {
|
||||
if (a > b) return 1;
|
||||
if (a < b) return -1;
|
||||
return 0;
|
||||
});
|
||||
});
|
||||
walker.on('names', function (root, nodeNamesArray) {
|
||||
nodeNamesArray.sort(function (a, b) {
|
||||
if (a > b) return 1;
|
||||
if (a < b) return -1;
|
||||
return 0;
|
||||
});
|
||||
});
|
||||
|
||||
walker.on("directories", function (root, dirStatsArray, next) {
|
||||
// dirStatsArray is an array of `stat` objects with the additional attributes
|
||||
// * type
|
||||
// * error
|
||||
// * name
|
||||
|
||||
next();
|
||||
});
|
||||
walker.on('directories', function (root, dirStatsArray, next) {
|
||||
// dirStatsArray is an array of `stat` objects with the additional attributes
|
||||
// * type
|
||||
// * error
|
||||
// * name
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
walker.on('file', function (root, fileStats, next) {
|
||||
fs.readFile(fileStats.name, function () {
|
||||
// doStuff
|
||||
next();
|
||||
});
|
||||
});
|
||||
|
||||
walker.on('errors', function (root, nodeStatsArray, next) {
|
||||
next();
|
||||
});
|
||||
|
||||
walker.on('end', function () {
|
||||
console.log('all done');
|
||||
});
|
||||
```
|
||||
|
||||
### Sync
|
||||
|
||||
Note: You **can't use EventEmitter** if you want truly synchronous walker
|
||||
(although it's synchronous under the hood, it appears not to be due to the use of `process.nextTick()`).
|
||||
|
||||
Instead **you must use `options.listeners`** for truly synchronous walker.
|
||||
|
||||
Although the sync version uses all of the `fs.readSync`, `fs.readdirSync`, and other sync methods,
|
||||
I don't think I can prevent the `process.nextTick()` that `EventEmitter` calls.
|
||||
|
||||
```javascript
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var walk = require('walk');
|
||||
var fs = require('fs');
|
||||
var options;
|
||||
var walker;
|
||||
|
||||
// To be truly synchronous in the emitter and maintain a compatible api,
|
||||
// the listeners must be listed before the object is created
|
||||
options = {
|
||||
listeners: {
|
||||
names: function (root, nodeNamesArray) {
|
||||
nodeNamesArray.sort(function (a, b) {
|
||||
if (a > b) return 1;
|
||||
if (a < b) return -1;
|
||||
return 0;
|
||||
});
|
||||
},
|
||||
directories: function (root, dirStatsArray, next) {
|
||||
// dirStatsArray is an array of `stat` objects with the additional attributes
|
||||
// * type
|
||||
// * error
|
||||
// * name
|
||||
|
||||
walker.on("file", function (root, fileStats, next) {
|
||||
fs.readFile(fileStats.name, function () {
|
||||
// doStuff
|
||||
next();
|
||||
});
|
||||
});
|
||||
},
|
||||
file: function (root, fileStats, next) {
|
||||
fs.readFile(fileStats.name, function () {
|
||||
// doStuff
|
||||
next();
|
||||
});
|
||||
},
|
||||
errors: function (root, nodeStatsArray, next) {
|
||||
next();
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
walker.on("errors", function (root, nodeStatsArray, next) {
|
||||
next();
|
||||
});
|
||||
walker = walk.walkSync('/tmp', options);
|
||||
|
||||
walker.on("end", function () {
|
||||
console.log("all done");
|
||||
});
|
||||
console.log('all done');
|
||||
})();
|
||||
```
|
||||
|
||||
API
|
||||
====
|
||||
# API
|
||||
|
||||
Emitted Values
|
||||
|
||||
* `on('XYZ', function(root, stats, next) {})`
|
||||
- `on('XYZ', function(root, stats, next) {})`
|
||||
|
||||
* `root` - the containing the files to be inspected
|
||||
* *stats[Array]* - a single `stats` object or an array with some added attributes
|
||||
* type - 'file', 'directory', etc
|
||||
* error
|
||||
* name - the name of the file, dir, etc
|
||||
* next - no more files will be read until this is called
|
||||
- `root` - the containing the files to be inspected
|
||||
- _stats[Array]_ - a single `stats` object or an array with some added attributes
|
||||
- type - 'file', 'directory', etc
|
||||
- error
|
||||
- name - the name of the file, dir, etc
|
||||
- next - no more files will be read until this is called
|
||||
|
||||
Single Events - fired immediately
|
||||
|
||||
* `end` - No files, dirs, etc left to inspect
|
||||
- `end` - No files, dirs, etc left to inspect
|
||||
|
||||
* `directoryError` - Error when `fstat` succeeded, but reading path failed (Probably due to permissions).
|
||||
* `nodeError` - Error `fstat` did not succeeded.
|
||||
* `node` - a `stats` object for a node of any type
|
||||
* `file` - includes links when `followLinks` is `true`
|
||||
* Note: This feature is broken in the current version, but works in the previous `walk-recursive` version
|
||||
* `directory`
|
||||
* `symbolicLink` - always empty when `followLinks` is `true`
|
||||
* `blockDevice`
|
||||
* `characterDevice`
|
||||
* `FIFO`
|
||||
* `socket`
|
||||
- `directoryError` - Error when `fstat` succeeded, but reading path failed (Probably due to permissions).
|
||||
- `nodeError` - Error `fstat` did not succeeded.
|
||||
- `node` - a `stats` object for a node of any type
|
||||
- `file` - includes links when `followLinks` is `true`
|
||||
- `directory` - **NOTE** you could get a recursive loop if `followLinks` and a directory links to its parent
|
||||
- `symbolicLink` - always empty when `followLinks` is `true`
|
||||
- `blockDevice`
|
||||
- `characterDevice`
|
||||
- `FIFO`
|
||||
- `socket`
|
||||
|
||||
Events with Array Arguments - fired after all files in the dir have been `stat`ed
|
||||
|
||||
* `names` - before any `stat` takes place. Useful for sorting and filtering.
|
||||
* Note: the array is an array of `string`s, not `stat` objects
|
||||
* Note: the `next` argument is a `noop`
|
||||
- `names` - before any `stat` takes place. Useful for sorting and filtering.
|
||||
|
||||
* `errors` - errors encountered by `fs.stat` when reading ndes in a directory
|
||||
* `nodes` - an array of `stats` of any type
|
||||
* `files`
|
||||
* `directories` - modification of this array - sorting, removing, etc - affects traversal
|
||||
* `symbolicLinks`
|
||||
* `blockDevices`
|
||||
* `characterDevices`
|
||||
* `FIFOs`
|
||||
* `sockets`
|
||||
- Note: the array is an array of `string`s, not `stat` objects
|
||||
- Note: the `next` argument is a `noop`
|
||||
|
||||
- `errors` - errors encountered by `fs.stat` when reading ndes in a directory
|
||||
- `nodes` - an array of `stats` of any type
|
||||
- `files`
|
||||
- `directories` - modification of this array - sorting, removing, etc - affects traversal
|
||||
- `symbolicLinks`
|
||||
- `blockDevices`
|
||||
- `characterDevices`
|
||||
- `FIFOs`
|
||||
- `sockets`
|
||||
|
||||
**Warning** beware of infinite loops when `followLinks` is true (using `walk-recurse` varient).
|
||||
|
||||
Comparisons
|
||||
====
|
||||
# Comparisons
|
||||
|
||||
Tested on my `/System` containing 59,490 (+ self) directories (and lots of files).
|
||||
The size of the text output was 6mb.
|
||||
|
||||
`find`:
|
||||
time bash -c "find /System -type d | wc"
|
||||
59491 97935 6262916
|
||||
time bash -c "find /System -type d | wc"
|
||||
59491 97935 6262916
|
||||
|
||||
real 2m27.114s
|
||||
user 0m1.193s
|
||||
|
@ -140,12 +278,12 @@ Note that `find.js` omits the start directory
|
|||
|
||||
time bash -c "node examples/find.js /System -type d | wc"
|
||||
59490 97934 6262908
|
||||
|
||||
# Test 1
|
||||
|
||||
# Test 1
|
||||
real 2m52.273s
|
||||
user 0m20.374s
|
||||
sys 0m27.800s
|
||||
|
||||
|
||||
# Test 2
|
||||
real 2m23.725s
|
||||
user 0m18.019s
|
||||
|
@ -158,12 +296,11 @@ Note that `find.js` omits the start directory
|
|||
|
||||
In conclusion node.js asynchronous walk is much slower than regular "find".
|
||||
|
||||
LICENSE
|
||||
===
|
||||
# LICENSE
|
||||
|
||||
`node-walk` is available under the following licenses:
|
||||
|
||||
* MIT
|
||||
* Apache 2
|
||||
- MIT
|
||||
- Apache 2
|
||||
|
||||
Copyright 2011 - Present AJ ONeal
|
||||
|
|
|
@ -47,7 +47,10 @@
|
|||
function emitSingleEvents(emitter, path, stats, next, self) {
|
||||
var num = 1 + emitter.listeners(stats.type).length + emitter.listeners("node").length;
|
||||
|
||||
function nextWhenReady() {
|
||||
function nextWhenReady(flag) {
|
||||
if (flag) {
|
||||
stats.flag = flag;
|
||||
}
|
||||
num -= 1;
|
||||
if (0 === num) { next.call(self); }
|
||||
}
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
{
|
||||
"name" : "walk",
|
||||
"description" : "A node port of python's os.walk",
|
||||
"url" : "github.com/coolaj86/node-walk",
|
||||
"keywords" : ["util", "os", "sys", "fs", "walk", "walkSync"],
|
||||
"author" : "AJ ONeal <coolaj86@gmail.com>",
|
||||
"contributors" : [],
|
||||
"dependencies" : {
|
||||
"forEachAsync": ">= 2.1.0"
|
||||
},
|
||||
"lib" : ".",
|
||||
"main" : "./walk.js",
|
||||
"version" : "2.1.1",
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "http://www.opensource.org/licenses/mit-license.php"
|
||||
},
|
||||
{
|
||||
"type": "Apache2",
|
||||
"url": "http://opensource.org/licenses/apache2.0.php"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -7,6 +7,7 @@
|
|||
function noop() {}
|
||||
|
||||
var fs = require('fs'),
|
||||
path = require('path'),
|
||||
EventEmitter = require('events').EventEmitter,
|
||||
TypeEmitter = require('./node-type-emitter');
|
||||
|
||||
|
@ -35,7 +36,7 @@
|
|||
emitter.emit('names', curpath, files, noop);
|
||||
files.forEachAsync(function (cont, file) {
|
||||
emitter.emit('name', curpath, file, noop);
|
||||
fs.lstat(curpath + '/' + file, function (err, stat) {
|
||||
fs.lstat(curpath + path.sep + file, function (err, stat) {
|
||||
stat = stat || {};
|
||||
stat.name = file;
|
||||
if (err) {
|
||||
|
@ -79,7 +80,7 @@
|
|||
}
|
||||
|
||||
function fullPath(v,i,o) {
|
||||
o[i]= [curpath, '/', v].join('');
|
||||
o[i]= [curpath, path.sep, v].join('');
|
||||
}
|
||||
|
||||
curpath = pathname;
|
||||
|
|
115
lib/walk.js
115
lib/walk.js
|
@ -1,22 +1,20 @@
|
|||
/*jshint strict:true node:true es5:true onevar:true laxcomma:true laxbreak:true*/
|
||||
// Adapted from work by jorge@jorgechamorro.com on 2010-11-25
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
// Array.prototype.forEachAsync(next, item, i, collection)
|
||||
//require('Array.prototype.forEachAsync');
|
||||
|
||||
function noop() {}
|
||||
|
||||
var fs = require('fs')
|
||||
, forEachAsync = require('forEachAsync')
|
||||
, forEachAsync = require('foreachasync').forEachAsync
|
||||
, EventEmitter = require('events').EventEmitter
|
||||
, TypeEmitter = require('./node-type-emitter')
|
||||
, util = require('util')
|
||||
, path = require('path')
|
||||
;
|
||||
|
||||
function appendToDirs(stat) {
|
||||
/*jshint validthis:true*/
|
||||
if(stat.flag && stat.flag === NO_DESCEND) { return; }
|
||||
this.push(stat.name);
|
||||
}
|
||||
|
||||
|
@ -31,23 +29,40 @@
|
|||
var me = this
|
||||
;
|
||||
|
||||
me._wsync = true;
|
||||
options = options || {};
|
||||
me._wStat = options.followLinks && 'stat' || 'lstat';
|
||||
me._wStatSync = me._wStat + 'Sync';
|
||||
me._wsync = sync;
|
||||
me._wq = [];
|
||||
me._wqueue = [me._wq];
|
||||
me._wcurpath = undefined;
|
||||
me._wfistrun = true;
|
||||
me._wfilters = options.filters || [];
|
||||
me._wfirstrun = true;
|
||||
me._wcurpath = pathname;
|
||||
|
||||
if (me._wsync) {
|
||||
//console.log('_walkSync');
|
||||
me._wWalk = me._wWalkSync;
|
||||
} else {
|
||||
//console.log('_walkASync');
|
||||
me._wWalk = me._wWalkAsync;
|
||||
}
|
||||
|
||||
// TODO just one little anony won't hurt...
|
||||
process.nextTick(function () {
|
||||
me._wWalk();
|
||||
options.listeners = options.listeners || {};
|
||||
Object.keys(options.listeners).forEach(function (event) {
|
||||
var callbacks = options.listeners[event]
|
||||
;
|
||||
|
||||
if ('function' === typeof callbacks) {
|
||||
callbacks = [callbacks];
|
||||
}
|
||||
|
||||
callbacks.forEach(function (callback) {
|
||||
me.on(event, callback);
|
||||
});
|
||||
});
|
||||
|
||||
me._wWalk();
|
||||
}
|
||||
|
||||
// Inherits must come before prototype additions
|
||||
|
@ -63,6 +78,7 @@
|
|||
if (err) {
|
||||
stat.error = err;
|
||||
//me.emit('error', curpath, stat);
|
||||
// TODO v3.0 (don't noop the next if there are listeners)
|
||||
me.emit('nodeError', me._wcurpath, stat, noop);
|
||||
me._wfnodegroups.errors.push(stat);
|
||||
me._wCurFileCallback();
|
||||
|
@ -82,18 +98,18 @@
|
|||
me._wCurFileCallback = cont;
|
||||
me.emit('name', me._wcurpath, file, noop);
|
||||
|
||||
statPath = me._wcurpath + '/' + file;
|
||||
statPath = me._wcurpath + path.sep + file;
|
||||
|
||||
if (!me._wsync) {
|
||||
// TODO how to remove this anony?
|
||||
fs.lstat(statPath, function (err, stat) {
|
||||
fs[me._wStat](statPath, function (err, stat) {
|
||||
me._wLstatHandler(err, stat);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
me._wLstatHandler(null, fs.lstatSync(statPath));
|
||||
me._wLstatHandler(null, fs[me._wStatSync](statPath));
|
||||
} catch(e) {
|
||||
me._wLstatHandler(e);
|
||||
}
|
||||
|
@ -113,6 +129,8 @@
|
|||
;
|
||||
|
||||
if (me._wfnodegroups.errors.length) {
|
||||
// TODO v3.0 (don't noop the next)
|
||||
// .errors is an array of stats with { name: name, error: error }
|
||||
me.emit('errors', me._wcurpath, me._wfnodegroups.errors, noop);
|
||||
}
|
||||
// XXX emitNodeTypes still needs refactor
|
||||
|
@ -140,36 +158,73 @@
|
|||
Walker.prototype._wReaddirHandler = function (err, files) {
|
||||
var fnodeGroups = TypeEmitter.createNodeGroups()
|
||||
, me = this
|
||||
, parent
|
||||
, child
|
||||
;
|
||||
|
||||
me._wfnodegroups = fnodeGroups;
|
||||
me._wcurfiles = files;
|
||||
|
||||
|
||||
// no error, great
|
||||
if (!err) {
|
||||
me._wReadFiles();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!me._wfistrun) {
|
||||
// TODO path.sep
|
||||
me._wcurpath = me._wcurpath.replace(/\/$/, '');
|
||||
|
||||
// error? not first run? => directory error
|
||||
if (!me._wfirstrun) {
|
||||
// TODO v3.0 (don't noop the next if there are listeners)
|
||||
me.emit('directoryError', me._wcurpath, { error: err }, noop);
|
||||
// TODO v3.0
|
||||
//me.emit('directoryError', me._wcurpath.replace(/^(.*)\/.*$/, '$1'), { name: me._wcurpath.replace(/^.*\/(.*)/, '$1'), error: err }, noop);
|
||||
me._wReadFiles();
|
||||
return;
|
||||
}
|
||||
|
||||
me._wfistrun = false;
|
||||
// TODO how to remove this anony?
|
||||
fs.lstat(me._wcurpath, function (e, stat) {
|
||||
// error? first run? => maybe a file, maybe a true error
|
||||
me._wfirstrun = false;
|
||||
|
||||
// readdir failed (might be a file), try a stat on the parent
|
||||
parent = me._wcurpath.replace(/^(.*)\/.*$/, '$1');
|
||||
fs[me._wStat](parent, function (e, stat) {
|
||||
|
||||
if (stat) {
|
||||
files = [me._wcurpath.replace(/.*\//, '')];
|
||||
me._wcurpath = me._wcurpath.replace(files[0], '');
|
||||
// success
|
||||
// now try stat on this as a child of the parent directory
|
||||
child = me._wcurpath.replace(/^.*\/(.*)$/, '$1');
|
||||
me._wcurfiles = [child];
|
||||
me._wcurpath = parent;
|
||||
} else {
|
||||
// TODO v3.0
|
||||
//me.emit('directoryError', me._wcurpath.replace(/^(.*)\/.*$/, '$1'), { name: me._wcurpath.replace(/^.*\/(.*)/, '$1'), error: err }, noop);
|
||||
// TODO v3.0 (don't noop the next)
|
||||
// the original readdir error, not the parent stat error
|
||||
me.emit('nodeError', me._wcurpath, { error: err }, noop);
|
||||
}
|
||||
|
||||
me._wReadFiles();
|
||||
});
|
||||
};
|
||||
Walker.prototype._wFilter = function () {
|
||||
var me = this
|
||||
, exclude
|
||||
;
|
||||
|
||||
// Stop directories that contain filter keywords
|
||||
// from continuing through the walk process
|
||||
exclude = me._wfilters.some(function (filter) {
|
||||
if (me._wcurpath.match(filter)) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
return exclude;
|
||||
};
|
||||
Walker.prototype._wWalkSync = function () {
|
||||
//console.log('walkSync');
|
||||
var err
|
||||
, files
|
||||
, me = this
|
||||
|
@ -184,6 +239,7 @@
|
|||
me._wReaddirHandler(err, files);
|
||||
};
|
||||
Walker.prototype._wWalkAsync = function () {
|
||||
//console.log('walkAsync');
|
||||
var me = this
|
||||
;
|
||||
|
||||
|
@ -201,21 +257,32 @@
|
|||
}
|
||||
if (me._wq.length) {
|
||||
me._wcurpath = me._wq.pop();
|
||||
me._wWalk();
|
||||
while (me._wq.length && me._wFilter()) {
|
||||
me._wcurpath = me._wq.pop();
|
||||
}
|
||||
if (me._wcurpath && !me._wFilter()) {
|
||||
me._wWalk();
|
||||
} else {
|
||||
me._wNext();
|
||||
}
|
||||
return;
|
||||
}
|
||||
me._wqueue.length -= 1;
|
||||
if (me._wqueue.length) {
|
||||
me._wq = me._wqueue[me._wqueue.length - 1];
|
||||
return this._wNext();
|
||||
return me._wNext();
|
||||
}
|
||||
me.emit('end');
|
||||
|
||||
// To not break compatibility
|
||||
//process.nextTick(function () {
|
||||
me.emit('end');
|
||||
//});
|
||||
};
|
||||
Walker.prototype._wJoinPath = function (v, i, o) {
|
||||
var me = this
|
||||
;
|
||||
|
||||
o[i] = [me._wcurpath, '/', v].join('');
|
||||
o[i] = [me._wcurpath, path.sep, v].join('');
|
||||
};
|
||||
Walker.prototype.pause = function () {
|
||||
this._paused = true;
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"name": "walk",
|
||||
"description": "A node port of python's os.walk",
|
||||
"url": "http://git.coolaj86.com/coolaj86/fs-walk.js",
|
||||
"keywords": [
|
||||
"util",
|
||||
"os",
|
||||
"sys",
|
||||
"fs",
|
||||
"walk",
|
||||
"walkSync"
|
||||
],
|
||||
"author": "AJ ONeal <coolaj86@gmail.com>",
|
||||
"contributors": [],
|
||||
"dependencies": {
|
||||
"foreachasync": "^3.0.0"
|
||||
},
|
||||
"lib": ".",
|
||||
"main": "./lib/walk.js",
|
||||
"version": "2.3.15",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"repository": {
|
||||
"url": "https://git.coolaj86.com/coolaj86/fs-walk.js.git"
|
||||
},
|
||||
"license": "(MIT OR Apache-2.0)",
|
||||
"bugs": {
|
||||
"url": "https://git.coolaj86.com/coolaj86/fs-walk.js/issues"
|
||||
},
|
||||
"homepage": "https://git.coolaj86.com/coolaj86/fs-walk.js",
|
||||
"directories": {
|
||||
"example": "examples",
|
||||
"test": "test"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"test": "./test/walk-test.sh"
|
||||
}
|
||||
}
|
15
test-walk.js
15
test-walk.js
|
@ -1,15 +0,0 @@
|
|||
/*jshint strict:true node:true es5:true onevar:true laxcomma:true laxbreak:true*/
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
var walk = require('./lib/walk').walk
|
||||
, walker
|
||||
;
|
||||
|
||||
walker = walk('./');
|
||||
walker.on('file', function (root, stat, next) {
|
||||
console.log(root, stat.name);
|
||||
next();
|
||||
});
|
||||
|
||||
}());
|
|
@ -0,0 +1,34 @@
|
|||
(function () {
|
||||
"use strict";
|
||||
|
||||
var walk = require('../lib/walk').walk
|
||||
, path = require('path')
|
||||
, dirname = process.argv[2] || './'
|
||||
, walker
|
||||
;
|
||||
|
||||
walker = walk(dirname);
|
||||
|
||||
walker.on('directories', function (root, stats, next) {
|
||||
stats.forEach(function (stat) {
|
||||
console.log('[ds]', path.join(root, stat.name));
|
||||
});
|
||||
next();
|
||||
});
|
||||
|
||||
/*
|
||||
walker.on('directory', function (root, stat, next) {
|
||||
console.log('[d]', path.join(root, stat.name));
|
||||
next();
|
||||
});
|
||||
*/
|
||||
|
||||
walker.on('file', function (root, stat, next) {
|
||||
console.log('[f]', path.join(root, stat.name));
|
||||
next();
|
||||
});
|
||||
|
||||
walker.on('end', function () {
|
||||
console.log('All Done!');
|
||||
});
|
||||
}());
|
|
@ -0,0 +1,43 @@
|
|||
(function () {
|
||||
"use strict";
|
||||
|
||||
var walk = require('../lib/walk')
|
||||
, fs = require('fs')
|
||||
, options
|
||||
, walker
|
||||
;
|
||||
|
||||
options = {
|
||||
listeners: {
|
||||
names: function (root, nodeNamesArray) {
|
||||
nodeNamesArray.sort(function (a, b) {
|
||||
if (a > b) return 1;
|
||||
if (a < b) return -1;
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
, directories: function (root, dirStatsArray, next) {
|
||||
// dirStatsArray is an array of `stat` objects with the additional attributes
|
||||
// * type
|
||||
// * error
|
||||
// * name
|
||||
|
||||
next();
|
||||
}
|
||||
, file: function (root, fileStats, next) {
|
||||
fs.readFile(fileStats.name, function () {
|
||||
// doStuff
|
||||
console.log(root, fileStats.name);
|
||||
next();
|
||||
});
|
||||
}
|
||||
, errors: function (root, nodeStatsArray, next) {
|
||||
next();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
walker = walk.walkSync("/tmp", options);
|
||||
|
||||
console.log("all done");
|
||||
}());
|
40
testSync.js
40
testSync.js
|
@ -1,40 +0,0 @@
|
|||
(function () {
|
||||
"use strict";
|
||||
|
||||
var walk = require('./lib/walk')
|
||||
, _ = require('underscore')
|
||||
, fs = require('fs')
|
||||
, sync = false
|
||||
, walker;
|
||||
|
||||
console.log(walk);
|
||||
|
||||
walker = walk.walk(".");
|
||||
|
||||
walker.on("directory", function (root, dirStatsArray, next) {
|
||||
// dirStatsArray is an array of `stat` objects with the additional attributes
|
||||
// * type
|
||||
// * error
|
||||
// * name
|
||||
//console.log(_.pluck(dirStatsArray, 'name'));
|
||||
console.log(root + '/' + dirStatsArray.name);
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
walker.on("file", function (root, fileStats, next) {
|
||||
console.log(root + '/' + fileStats.name);
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
walker.on("errors", function (root, nodeStatsArray, next) {
|
||||
//console.log(nodeStatsArray);
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
walker.on("end", function () {
|
||||
console.log("all done");
|
||||
});
|
||||
}());
|
Loading…
Reference in New Issue