{"id":18389,"library":"glob-fs-gitignore","title":"glob-fs-gitignore","description":"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.","status":"maintenance","version":"0.1.6","language":"javascript","source_language":"en","source_url":"https://github.com/jonschlinkert/glob-fs-gitignore","tags":["javascript","fs","gitignore","glob","glob-fs","ignore","middleware","parse","pattern"],"install":[{"cmd":"npm install glob-fs-gitignore","lang":"bash","label":"npm"},{"cmd":"yarn add glob-fs-gitignore","lang":"bash","label":"yarn"},{"cmd":"pnpm add glob-fs-gitignore","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; this middleware requires glob-fs to function.","package":"glob-fs","optional":false}],"imports":[{"note":"The default export is a function. In CommonJS, use require('glob-fs-gitignore') directly.","wrong":"const { gitignore } = require('glob-fs-gitignore')","symbol":"default","correct":"import gitignore from 'glob-fs-gitignore'"},{"note":"CommonJS require returns the function directly; no .default needed.","wrong":"const gitignore = require('glob-fs-gitignore').default","symbol":"default (CommonJS)","correct":"const gitignore = require('glob-fs-gitignore')"},{"note":"The module has no type definitions; use @types/glob-fs-gitignore or declare module.","wrong":"import * as gitignore from 'glob-fs-gitignore'","symbol":"TypeScript usage","correct":"import gitignore from 'glob-fs-gitignore'"}],"quickstart":{"code":"const glob = require('glob-fs')({ dotfiles: true });\nconst gitignore = require('glob-fs-gitignore');\n\nglob.use(gitignore())\n  .readdir('**/*', function(err, files) {\n    if (err) throw err;\n    console.log(files);\n  });","lang":"javascript","description":"Demonstrates using glob-fs-gitignore middleware to ignore .gitignore patterns while globbing."},"warnings":[{"fix":"Use glob-fs without disabling defaults; it includes gitignore handling automatically.","message":"Note: 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.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Ensure to invoke gitignore() as a function: glob.use(gitignore())","message":"The middleware must be called as a function (gitignore()) when passed to .use(). Omitting parentheses yields an error or unexpected behavior.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'0.1.6':21 '0.12.0':81 '2017':25 'altern':62 'automat':11 'awar':49 'built':26 'differ':60 'directori':15 'ecosystem':37 'file':13,50 'fs':3,9,36,44,72,83,88 'gitignor':4,18,48,84 'gitignore-awar':47 'glob':2,8,35,43,51,71,85,87 'glob-f':7,34,42,70,86 'glob-fs-gitignor':1 'ignor':12,64,89 'integr':39 'javascript':82 'jon':28 'last':22 'librari':77 'like':63 'maintain':58 'middlewar':5,68,90 'minim':57 'node.js':80 'packag':53 'pars':91 'part':31 'pattern':19,92 'provid':46 'rather':73 'schlinkert':29 'seamless':40 'specifi':16 'stabl':55 'standalon':76 'updat':23 'version':20 'work':78","created_at":"2026-04-25T07:37:59.497283+00:00","updated_at":"2026-04-25T07:37:59.497283+00:00","problems":[{"fix":"Use const gitignore = require('glob-fs-gitignore');","cause":"Importing incorrectly in CommonJS, e.g., const { gitignore } = require('glob-fs-gitignore') when the module exports a function directly.","error":"TypeError: gitignore is not a function"},{"fix":"Run npm install glob-fs-gitignore glob-fs","cause":"The package is not installed or is missing from node_modules. Also ensure glob-fs is installed as a peer dependency.","error":"Cannot find module 'glob-fs-gitignore'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/jonschlinkert/glob-fs-gitignore","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/glob-fs-gitignore","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}