1.4.1 • Published 11 months ago

complete-file-system-cache v1.4.1

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

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 is true.
  • Returns: FilePaths
cleanCache()
  • Returns: void

Cleans the cache.

1.4.1

11 months ago

1.4.0

11 months ago

1.3.5

12 months ago

1.3.4

12 months ago

1.3.3

12 months ago

1.3.2

12 months ago

1.3.1

12 months ago

1.3.0

12 months ago

1.0.0

12 months ago

1.2.0

12 months ago