Filesystem API, Pure-JS glob implementation

Skip to first unread message

Kris Kowal

Aug 30, 2009, 4:25:28 AM8/30/09
I believe Wes asked for a pure-javascript implementation of glob. I
finished one tonight, and it should work anywhere you implement:

* isAbsolute
* listDirectoryTree
returns an array of the directories under a given
directory, including itself
* list
returns an array of the names of every file or directory
under a given path

It still needs a test suite. I'm probably going to do this by way of
creating a sandbox with a virtual file module implementation so I can
run various scenarios on a consistently reconstructed file system
view, without having to muddy up the disk and leave it in inconsistent
states when tests fail.

This comes out of Tom's and my experiments to assess how much of the
CommonJS specifications can be in pure-JavaScript and thus shared
among CommonJS implementations.

Kris Kowal

Wes Garland

Aug 30, 2009, 10:37:07 AM8/30/09
Hi Kris!

That's a particularly valuable piece of kit.

Along the lines with those experiments, we are currently implementing narwhal's file API by substituting GPSEE FFI calls in file-(platform|engine).js. I think this is a pretty good way to build CommonJS.  Emacs has certainly shown that the technique works!

Wesley W. Garland
Director, Product Development
PageMail, Inc.
+1 613 542 2787 x 102
Reply all
Reply to author
0 new messages