Wondering what’s next for npm?Check out our public roadmap! »

    srls

    1.0.0 • Public • Published

    Build Status

    synchronous recursive ls

    This package provides just one super simple synchronous ls -r implementation with the following characteristics:

    • returns a flat array of absolute paths
    • contains no entries for directories, only their files
    • files are always listed before subdirectory contents
    • within each directory entries are sorted by their unicode value

    Example

    var ls = require('srls');
    var files = ls('/tmp/test/');

    Given the following directory structure in /tmp/test:

    .
    |-- 000.txt
    |-- bar
    |   `-- baz.txt
    |-- baz
    |   `-- boo.txt
    |-- foo.txt
    `-- z.txt
    

    … the code above will yield the following result:

    [
      "/tmp/test/000.txt",
      "/tmp/test/foo.txt",
      "/tmp/test/z.txt",
      "/tmp/test/bar/baz.txt",
      "/tmp/test/baz/boo.txt"
    ]
    

    License

    MIT

    Install

    npm i srls

    DownloadsWeekly Downloads

    3

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • avatar