Skip to content
John Shelburne
Go back

Now This Is Search

Edit page

Why Should I Care?

Fast-glob is a high-performance file system globbing library for Node.js that offers significant speed improvements over traditional glob implementations. As reported by npm-compare.com, fast-glob is designed to be up to 60% faster than conventional globbing libraries, making it particularly effective for tasks involving large-scale file searching and manipulation in Node.js applications.

What is Glob

Glob is a pattern-matching technique used in computer programming to specify sets of filenames or pathnames using wildcard characters. Originally developed for Unix shells, glob patterns have become a standard feature in many programming languages and file system utilities. The term “glob” is derived from “global command” in early Unix systems.Key aspects of glob include:

Glob patterns offer versatile functionality for managing files and directories across various operating systems and programming environments. They enable path matching, allowing for file and directory name matching over multiple file system levels, ensuring efficient searching without unnecessary traversals. Originally a Unix concept, glob patterns are now supported widely across different platforms.

Commonly applied in tasks such as file searching, build processes, and configuration files, glob patterns provide a straightforward and powerful method to identify groups of files or directories. Here are some practical uses for glob patterns:

These examples illustrate how glob patterns can simplify file operations for users with diverse levels of technical expertise, from casual users to professional developers and system administrators.## Who Built It Dude who built the tool works at Yandex (Russias version of Google) https://www.canonium.com https://github.com/mrmlnc Has a good list of glob repositories https://github.com/stars/mrmlnc/lists/glob

How To Setup

Instructions to Use the Script 1. Install fast-glob if it’s not already installed:

npm install fast-glob

Here are the next steps after installing fast-glob:

  1. Create a script to utilize fast-glob in your project:

    touch glob-script.js

  2. Add the import to your script:

    echo “const glob = require(‘fast-glob’);” > glob-script.js

  3. Run your first glob pattern:

    node glob-script.js

Simple script I ran on Katana Master Repository


// Import necessary modules const fs = require(‘fs’) const path = require(‘path’) const fg = require(‘fast-glob’) // Function to search for a word in a file async function searchWordInFiles(directory, word) { try { // Find all files in the specified directory const files = await fg(${directory}/**/*.*) // Iterate over each file for (const file of files) { const content = fs.readFileSync(file, ‘utf-8’) // Check if the file content contains the word if (content.includes(word)) { console.log("${word}" found in: ${file}) } } } catch (error) { console.error(‘Error occurred:’, error) } } // Call the function to search for ‘bookmarks’ in the ‘pipelines’ folder searchWordInFiles(‘pipelines’, ‘bookmarks’)

File called globtest.js then I ran node globtest.js in terminal and damn!!!!

The term “universe” has been detected in the following locations:


Edit page
Share this post on:

Previous Post
Creating A Template And Automating To Github
Next Post
The LEI is the key & the key is the LEI