Registry / devops / glob-fs-gitignore

glob-fs-gitignore

JSON →
library0.1.6jsnpmunverified

Middleware for glob-fs that automatically ignores files and directories specified in .gitignore patterns. Version 0.1.6, last updated in 2017. Built by Jon Schlinkert as part of the glob-fs ecosystem. It integrates seamlessly with glob-fs to provide gitignore-aware file globbing. The package is stable but minimally maintained. It differs from alternatives like ignore by being a middleware for glob-fs rather than a standalone library. Works with Node.js >=0.12.0.

npm install glob-fs-gitignore
INSTALL
IMPORT
SIG · GLOB-FS-GITIGNORE
G
glob-fs-gitignore
devopsjavascriptv0.1.6
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import gitignore from 'glob-fs-gitignore'
✗ const { gitignore } = require('glob-fs-gitignore')
The default export is a function. In CommonJS, use require('glob-fs-gitignore') directly.
default (CommonJS)
✓ const gitignore = require('glob-fs-gitignore')
✗ const gitignore = require('glob-fs-gitignore').default
CommonJS require returns the function directly; no .default needed.
TypeScript usage
✓ import gitignore from 'glob-fs-gitignore'
✗ import * as gitignore from 'glob-fs-gitignore'
The module has no type definitions; use @types/glob-fs-gitignore or declare module.

Demonstrates using glob-fs-gitignore middleware to ignore .gitignore patterns while globbing.

const glob = require('glob-fs')({ dotfiles: true }); const gitignore = require('glob-fs-gitignore'); glob.use(gitignore()) .readdir('**/*', function(err, files) { if (err) throw err; console.log(files); });
Debug
Known issues
deprecatedNote: glob-fs-gitignore is built-in to glob-fs as default middleware. Only use this package if you have disabled the default middleware stack in glob-fs.
fix
Use glob-fs without disabling defaults; it includes gitignore handling automatically.
affects: >=0.1.0
gotchaThe middleware must be called as a function (gitignore()) when passed to .use(). Omitting parentheses yields an error or unexpected behavior.
fix
Ensure to invoke gitignore() as a function: glob.use(gitignore())
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: gitignore is not a function
Importing incorrectly in CommonJS, e.g., const { gitignore } = require('glob-fs-gitignore') when the module exports a function directly.
fix
Use const gitignore = require('glob-fs-gitignore');
Cannot find module 'glob-fs-gitignore'
The package is not installed or is missing from node_modules. Also ensure glob-fs is installed as a peer dependency.
fix
Run npm install glob-fs-gitignore glob-fs
Upgrade
Version history
0.1.6latest on npm
Audit
Dependencies
glob-fsrequiredPeer dependency; this middleware requires glob-fs to function.
Agent activity
2 hits · last 30 days
node
2
Resources
glob-fs-gitignore — npm install glob-fs-gitignore · libregistry