Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@hoge1e3/bottomup

hoge1e34MIT1.0.0TypeScript support: included

A bottom-up directory traversal utility that iterates files in order of recent updates. Compatible with @hoge1e3/sfile.

filesystem, directory, traversal, bottom-up, sfile, recursive, iterator, nodejs, utility

readme

@hoge1e3/bottomup

A bottom-up directory traversal utility that yields files ordered by their last update time. Designed to work with @hoge1e3/sfile's SFile API.

Features

  • Traverses directories recursively
  • Sorts files by recent modification (most recent first)
  • Skips excluded files and folders based on pattern or function
  • Optionally moves up to parent directories

Installation

npm install @hoge1e3/bottomup

Usage

import bottomup from "@hoge1e3/bottomup";
import { SFile } from "@hoge1e3/sfile";

const root = SFile.get("./some/dir");
for (const file of bottomup(root, {
  excludes: [/node_modules/, "dist"]
})) {
  console.log(file.path());
}

API

bottomup(dir: SFile, opt?: DirectoryOptions): Generator<SFile>

  • dir: Root directory to start traversal
  • opt.excludes: A string, regex, function, or array of these used to skip files/dirs

License

MIT

Author

hoge1e3