complete-file-system-cache
v1.4.1
Published
Caches every file that exists in the file system and stores the whole file system files
Downloads
2
Maintainers
Readme
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
FileSystemCache
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()
- Returns:
void
Creates a file system cache if it already does not exist.
reloadFileSystemCache()
- Returns:
void
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 istrue
.- Returns:
FilePaths
cleanCache()
- Returns:
void
Cleans the cache.