@wxn0brp/db-core
    Preparing search index...

    Class CustomFileCpu

    Implements

    Index

    Constructors

    Properties

    _readFile: ReadFile
    _writeFile: WriteFile

    Methods

    • Asynchronously adds an entry to a file.

      Parameters

      • file: string

        The path to the file.

      • data: Data

        The data to add.

      Returns Promise<void>

      A promise resolving to void.

    • Asynchronously finds multiple entries in a file based on search criteria.

      Parameters

      • file: string

        The path to the file.

      • search: Search

        The search criteria.

      • context: VContext = {}

        Additional context for the search.

      • findOpts: FindOpts = {}

        Additional options for searching.

      Returns Promise<false | any[]>

      A promise resolving to an array of found entries, or false if the file does not exist.

    • Asynchronously finds one entry in a file based on search criteria.

      Parameters

      • file: string

        The path to the file.

      • search: Search

        The search criteria.

      • context: VContext = {}

        Additional context for the search.

      • findOpts: FindOpts = {}

        Additional options for searching.

      Returns Promise<any>

      A promise resolving to the found entry or false if not found.

    • Asynchronously removes entries from a file based on search criteria.

      Parameters

      • file: string

        The path to the file.

      • one: boolean

        If true, removes only the first matching entry.

      • search: Search

        The search criteria.

      • context: VContext = {}

        Additional context for the operation.

      Returns Promise<boolean>

      A promise resolving to true if at least one entry was removed, otherwise false.

    • Asynchronously updates entries in a file based on search criteria and an updater function or object.

      Parameters

      • file: string

        The path to the file.

      • one: boolean

        If true, updates only the first matching entry.

      • search: Search

        The search criteria.

      • updater: Updater

        The updater function or object.

      • context: VContext = {}

        Additional context for the operation.

      Returns Promise<boolean>

      A promise resolving to true if at least one entry was updated, otherwise false.