HED JavaScript Library
    Preparing search index...

    Class BidsFileAccessor

    Base class for BIDS file accessors.

    This class provides a common interface for accessing files in a BIDS dataset, regardless of the underlying storage mechanism. Subclasses must implement the create and getFileContent methods.

    Hierarchy (View Summary)

    Index

    Constructors

    • Constructs a BidsFileAccessor.

      Parameters

      • datasetRootDirectory: string

        The root directory of the dataset.

      • fileMap: Map<string, any>

        A map of relative file paths to file representations (e.g., File objects for web, full paths for Node.js).

      Returns BidsFileAccessor

    Properties

    datasetRootDirectory: string

    The root directory of the dataset.

    fileMap: Map<string, any>

    Map of relative file paths to file representations.

    organizedPaths: Map<string, Map<string, string[]>>

    Organized paths.

    SPECIAL_DIRS: string[] = ...

    BIDS special directories.

    SUFFIXES: string[] = ...

    BIDS suffixes.

    Methods

    • Asynchronously reads the content of a file.

      This method must be implemented by subclasses to handle environment-specific file reading.

      Parameters

      • relativePath: string

        The relative path to the file.

      Returns Promise<string>

      A promise that resolves with the file content as a string, or null if the file cannot be read.

      If the method is not implemented by a subclass.

    • Factory method to create a BidsFileAccessor.

      This method must be implemented by subclasses to handle environment-specific setup.

      Parameters

      • datasetRootDirectory: any

        The root directory of the dataset or a file-like object.

      Returns Promise<BidsFileAccessor>

      A Promise that resolves to a new BidsFileAccessor instance.

      If the method is not implemented by a subclass.