tinyglobby
TypeScript icon, indicating that this package has built-in type declarations

0.2.10 • Public • Published

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:

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.2.10
1,617,200latest

Version History

VersionDownloads (Last 7 Days)Published
0.2.10
1,617,200
0.2.9
471,321
0.2.8
4,399
0.2.7
11,341
0.2.6
291,299
0.2.5
50,787
0.2.2
28,266
0.2.1
2,035
0.2.0
19,255
0.1.2
0
0.1.1
0
0.1.0
0

Package Sidebar

Install

npm i tinyglobby

Weekly Downloads

2,495,917

Version

0.2.10

License

MIT

Unpacked Size

24.4 kB

Total Files

7

Last publish

Collaborators

  • superchupu