
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
glob-search
Advanced tools
glob search from current cwd up to root or stopPath
npm install glob-search
export declare function globSearch<T extends EntryItem = string>(pattern: string | string[], options?: IOptions<T>): Bluebird<IReturnValue<T>>;
export declare function globSearchSync<T extends EntryItem = string>(pattern: string | string[], options?: IOptions<T>): IReturnValueSync<T>;
export interface IOptions<T extends EntryItem> extends FastGlob.Options<T> {
cwd?: string;
deep?: number | boolean;
/**
* @default current package path
*/
stopPath?: string | string[] | boolean;
/**
* @default true
*/
followSymlinkedDirectories?: boolean;
sortCompareFn?: boolean | ((a: T, b: T) => number);
ignore?: string[];
disableThrowWhenEmpty?: boolean;
pathLib?: IPathLibBase;
}
export interface IReturnValue<T extends EntryItem> {
value: T[];
cwd: string;
pattern: string[];
options: IOptionsRuntime<T>;
history: string[];
errData?: Partial<IReturnError<T>>;
}
export interface IReturnValueSync<T extends EntryItem> extends IReturnValue<T> {
then<R>(fn: (data: IReturnValueSync<T>) => R): R;
catch<R>(fn: (err: IReturnError<T>) => R): IReturnValueSync<T> & R;
tap(fn: (data: IReturnValueSync<T>) => any): IReturnValueSync<T>;
tapCatch(fn: (err: IReturnError<T>) => any): IReturnValueSync<T>;
}
export declare type IReturnError<T extends EntryItem, E extends Error = Error> = E & {
message: string;
_data: {
cwd: string;
pattern: string[];
options: IOptionsRuntime<T>;
history: string[];
};
};
/
└── ws-ts-uglify
└── package.json
└── test
├── demo.ts
├── demo.d.ts
└── demo.js
└── packages
└── glob-search
├── package.json
└── test
├── demo.ts
└── demo.js
import { globSearch, globSearchSync, async, sync } from 'glob-search';
import { expect } from 'chai';
globSearch('*/demo.ts', {
//disableThrowWhenEmpty: true,
})
.tap(function (data)
{
console.log(data);
expect(data.value[0]).to.deep.equal('test/demo.ts')
})
.catch(console.error)
;
let data = globSearchSync('*/demo.ts', {
//disableThrowWhenEmpty: true,
});
console.log(data);
expect(data.value[0]).to.deep.equal('test/demo.ts');
fake async style
globSearchSync('*/demo.ts', {
//disableThrowWhenEmpty: true,
})
.tap(function (data)
{
console.log(data);
expect(data.value[0]).to.deep.equal('test/demo.ts')
})
.catch(console.error)
;
by the default will set
stopPathin current package root, can set it tofalseor other value
{ value: [ 'test/demo.ts' ],
cwd:
'/ws-ts-uglify/packages/glob-search',
options:
{ followSymlinkedDirectories: true,
markDirectories: true,
unique: true,
cwd:
'/ws-ts-uglify/packages/glob-search',
ignore: [],
stopPath:
[ '/ws-ts-uglify/packages/glob-search' ],
disableThrowWhenEmpty: false },
history:
[ '/ws-ts-uglify/packages/glob-search/test',
'/ws-ts-uglify/packages/glob-search' ] }
FAQs
glob search from current cwd up to root or stopPath
We found that glob-search demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.