# Class FileArtifactService

Service for managing artifacts stored on the local filesystem.

Stores filesystem-backed artifacts beneath a configurable root directory.

Storage layout matches the cloud and in-memory services: root/ └── users/ └── {userId}/ ├── sessions/ │ └── {sessionId}/ │ └── artifacts/ │ └── {artifactPath}/ // derived from filename │ └── versions/ │ └── {version}/ │ ├── {originalFilename} │ └── metadata.json └── artifacts/ └── {artifactPath}/...

Artifact paths are derived from the provided filenames: separators create nested directories, and path traversal is rejected to keep the layout portable across filesystems. `{artifactPath}` therefore mirrors the sanitized, scope-relative path derived from each filename.

#### Implements

- BaseArtifactService

- Defined in artifacts/file_artifact_service.ts:58

## Constructors

### constructor

- new FileArtifactService(rootDirOrUri: string): FileArtifactService

  #### Parameters

  - rootDirOrUri: string

  #### Returns FileArtifactService

  - Defined in artifacts/file_artifact_service.ts:61

## Methods

### deleteArtifact

- deleteArtifact(request: DeleteArtifactRequest): Promise<void>

  Deletes an artifact.

  #### Parameters

  - request: DeleteArtifactRequest

    The request to delete an artifact.

  #### Returns Promise<void>

  A promise that resolves when the artifact is deleted.

  Implementation of BaseArtifactService.deleteArtifact

  - Defined in artifacts/file_artifact_service.ts:267

### getArtifactVersion

- getArtifactVersion(
  request: LoadArtifactRequest,
  ): Promise<ArtifactVersion | undefined>

  Gets metadata for a specific artifact version.

  #### Parameters

  - request: LoadArtifactRequest

    The request to get an artifact version.

  #### Returns Promise<ArtifactVersion | undefined>

  A promise that resolves to the artifact version metadata or undefined.

  Implementation of BaseArtifactService.getArtifactVersion

  - Defined in artifacts/file_artifact_service.ts:351

### listArtifactKeys

- listArtifactKeys(request: ListArtifactKeysRequest): Promise<string[]>

  Lists all the artifact filenames within a session.

  #### Parameters

  - request: ListArtifactKeysRequest

    The request to list artifact keys.

  #### Returns Promise<string[]>

  A promise that resolves to a list of all artifact filenames within a session.

  Implementation of BaseArtifactService.listArtifactKeys

  - Defined in artifacts/file_artifact_service.ts:233

### listArtifactVersions

- listArtifactVersions(request: ListVersionsRequest): Promise<ArtifactVersion[]>

  Lists metadata for each artifact version.

  #### Parameters

  - request: ListVersionsRequest

    The request to list artifact versions.

  #### Returns Promise<ArtifactVersion[]>

  A promise that resolves to a list of artifact version metadata.

  Implementation of BaseArtifactService.listArtifactVersions

  - Defined in artifacts/file_artifact_service.ts:310

### listVersions

- listVersions(request: ListVersionsRequest): Promise<number[]>

  Lists all versions of an artifact.

  #### Parameters

  - request: ListVersionsRequest

    The request to list versions.

  #### Returns Promise<number[]>

  A promise that resolves to a list of all available versions of the artifact.

  Implementation of BaseArtifactService.listVersions

  - Defined in artifacts/file_artifact_service.ts:288

### loadArtifact

- loadArtifact(request: LoadArtifactRequest): Promise<Part | undefined>

  Gets an artifact from the artifact service storage.

  The artifact is a file identified by the app name, user ID, session ID, and filename.

  #### Parameters

  - request: LoadArtifactRequest

    The request to load an artifact.

  #### Returns Promise<Part | undefined>

  A promise that resolves to the artifact or undefined if not found.

  Implementation of BaseArtifactService.loadArtifact

  - Defined in artifacts/file_artifact_service.ts:132

### saveArtifact

- saveArtifact(request: SaveArtifactRequest): Promise<number>

  Saves an artifact to the artifact service storage.

  The artifact is a file identified by the app name, user ID, session ID, and filename. After saving the artifact, a revision ID is returned to identify the artifact version.

  #### Parameters

  - request: SaveArtifactRequest

    The request to save an artifact.

  #### Returns Promise<number>

  A promise that resolves to The revision ID. The first version of the artifact has a revision ID of 0. This is incremented by 1 after each successful save.

  Implementation of BaseArtifactService.saveArtifact

  - Defined in artifacts/file_artifact_service.ts:72