No description
  • TypeScript 100%
Find a file
Superchupu b9aa5fd0f1
fix test script on linux
running tests now requires node >=22.10.0 :^)
2024-10-27 19:20:59 +01:00
.github chore(deps): update all non-major dependencies (#60) 2024-10-25 09:19:56 +02:00
.vscode use --experimental-transform-types for tests 2024-08-24 13:01:06 +01:00
src early out if pattern array is empty (#65) 2024-10-25 13:00:14 +02:00
test do not process negative patterns in ignore 2024-10-17 17:31:02 +02:00
.gitattributes initial commit 2024-07-22 19:17:40 +01:00
.gitignore initial commit 2024-07-22 19:17:40 +01:00
biome.json chore(deps): update all non-major dependencies (#60) 2024-10-25 09:19:56 +02:00
CHANGELOG.md release 0.2.10 2024-10-25 09:32:33 +02:00
LICENSE relicense to MIT 2024-09-24 20:20:29 +02:00
package.json fix test script on linux 2024-10-27 19:20:59 +01:00
pnpm-lock.yaml chore(deps): update all non-major dependencies (#60) 2024-10-25 09:19:56 +02:00
README.md docs: add two more projects to readme (#56) 2024-10-16 22:57:30 +02:00
tsconfig.json use isolatedDeclarations typescript option 2024-09-16 17:07:31 +02:00
tsup.config.ts disable sourcemaps on release builds 2024-09-17 21:35:12 +02:00

tinyglobby

npm version monthly downloads

A fast and minimal alternative to globby and fast-glob, meant to behave the same way.

Both globby and fast-glob present some behavior no other globbing lib has, which makes it hard to manually replace with something smaller and better.

This library uses only two subdependencies, compared to globby's 23 and fast-glob's 17.

Usage

import { glob, globSync } from 'tinyglobby';

await glob(['files/*.ts', '!**/*.d.ts'], { cwd: 'src' });
globSync(['src/**/*.ts'], { ignore: ['**/*.d.ts'] });

API

  • glob(patterns: string | string[], options: GlobOptions): Promise<string[]>: Returns a promise with an array of matches.
  • globSync(patterns: string | string[], options: GlobOptions): string[]: Returns an array of matches.
  • convertPathToPattern(path: string): string: Converts a path to a pattern depending on the platform.
  • escapePath(path: string): string: Escapes a path's special characters depending on the platform.
  • isDynamicPattern(pattern: string, options?: GlobOptions): boolean: Checks if a pattern is dynamic.

Options

  • patterns: An array of glob patterns to search for. Defaults to ['**/*'].
  • ignore: An array of glob patterns to ignore.
  • cwd: The current working directory in which to search. Defaults to process.cwd().
  • absolute: Whether to return absolute paths. Defaults to false.
  • dot: Whether to allow entries starting with a dot. Defaults to false.
  • deep: Maximum depth of a directory. Defaults to Infinity.
  • followSymbolicLinks: Whether to traverse and include symbolic links. Defaults to true.
  • caseSensitiveMatch: Whether to match in case-sensitive mode. Defaults to true.
  • expandDirectories: Whether to expand directories. Disable to best match fast-glob. Defaults to true.
  • onlyDirectories: Enable to only return directories. Disables onlyFiles if set. Defaults to false.
  • onlyFiles: Enable to only return files. Defaults to true.

Used by

tinyglobby is downloaded many times by projects all around the world. Here's a list of notable projects that use it: