Complete File System Cache v1.4.1 Documentation
Table of contents
Installation
npm i complete-file-system-cache
Description
Caches every file that exists in the file system and stores the whole
file system files, where you want it to store and based on that it can
do fast search in the cached content.
Usage example
import { CompleteFileSystemCache } from 'complete-file-system-cache'
import { dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
const completeFileSystemCache = new CompleteFileSystemCache(__dirname)
completeFileSystemCache.cacheFileSystem()
const results = completeFileSystemCache.search(
['/Users/datomarjanidze'],
['.git', 'node_modules', '.cache', '.angular']
)
API
Types
export type FilePaths = string[]
CompleteFileSystemCache properties
cachedFileSystem
Returns the FileSystemCache
if it exists.
CompleteFileSystemCache methods
constructor(projectRootDir)
projectRootDir: string
This directory path will be used to store the
file system cache.
cacheFileSystem()
Creates a file system cache if it already does not exist.
reloadFileSystemCache()
Recreates the file system cache.
search(includedPathSegments, excludedPathSegments, ignoreCase)
includedPathSegments: string[] | RegExp
Path segments which should
be included from the search results.excludedPathSegments: string[]
Default: []
Path segments
which should be excluded from the search results.ignoreCase
Default: true
Executes case insensitive search,
if the provided argument is true
.- Returns:
FilePaths
cleanCache()
Cleans the cache.