@shopify/cli-kit
    Preparing search index...

    Interface VirtualFileSystem

    Represents a theme on the file system.

    interface VirtualFileSystem {
        addEventListener: <T extends ThemeFSEventName>(
            eventName: T,
            cb: (params: ThemeFSEventPayload<T>) => void,
        ) => void;
        delete: (fileKey: string) => Promise<void>;
        files: Map<string, ThemeAsset>;
        read: (
            fileKey: string,
        ) => Promise<string | Buffer<ArrayBufferLike> | undefined>;
        ready: () => Promise<void>;
        root: string;
        unsyncedFileKeys: Set<string>;
        write: (asset: ThemeAsset) => Promise<void>;
    }

    Hierarchy (View Summary)

    Index

    Properties

    addEventListener: <T extends ThemeFSEventName>(
        eventName: T,
        cb: (params: ThemeFSEventPayload<T>) => void,
    ) => void

    Add callbacks to run after certain events are fired.

    delete: (fileKey: string) => Promise<void>

    Removes a file from the local disk and updates the file system

    Type Declaration

      • (fileKey: string): Promise<void>
      • Parameters

        • fileKey: string

          The key of the file to remove

        Returns Promise<void>

    files: Map<string, ThemeAsset>

    Local files.

    read: (fileKey: string) => Promise<string | Buffer<ArrayBufferLike> | undefined>

    Reads a file from the local disk and updates the file system Returns a ThemeAsset representing the file that was read Returns undefined if the file does not exist

    Type Declaration

      • (fileKey: string): Promise<string | Buffer<ArrayBufferLike> | undefined>
      • Parameters

        • fileKey: string

          The key of the file to read

        Returns Promise<string | Buffer<ArrayBufferLike> | undefined>

    ready: () => Promise<void>

    Promise that resolves when all the initial files are found.

    root: string

    The root path of the theme.

    unsyncedFileKeys: Set<string>

    File keys that have been modified in memory and are not uploaded yet.

    write: (asset: ThemeAsset) => Promise<void>

    Writes a file to the local disk and updates the file system

    Type Declaration

      • (asset: ThemeAsset): Promise<void>
      • Parameters

        • asset: ThemeAsset

          The ThemeAsset representing the file to write

        Returns Promise<void>