Class ImageDownloadOptions
- Namespace
- CivitaiSharp.Tools.Downloads.Options
- Assembly
- CivitaiSharp.Tools.dll
Configuration options for image download operations.
public sealed class ImageDownloadOptions
- Inheritance
-
ImageDownloadOptions
- Inherited Members
Remarks
Bind this class from configuration using the section path "CivitaiDownloads:Images".
Path patterns support the following tokens:
| Token | Description |
|---|---|
| {Id} | The unique image identifier (required) |
| {PostId} | The post identifier containing the image |
| {Username} | The creator's username |
| {Width} | Image width in pixels |
| {Height} | Image height in pixels |
| {BaseModel} | The base model used for generation |
| {NsfwLevel} | The NSFW content level |
| {Date} | The creation date in yyyy-MM-dd format |
| {Extension} | The file extension (inferred from URL or media type) |
Properties
BaseDirectory
Gets or sets the base directory where downloaded images will be saved.
public string BaseDirectory { get; set; }
Property Value
Remarks
Defaults to the system temporary directory. The directory will be created if it does not exist.
OverwriteExisting
Gets or sets whether existing files should be overwritten.
public bool OverwriteExisting { get; set; }
Property Value
Remarks
When false (default), downloads will fail if the destination file already exists. When true, existing files will be replaced.
PathPattern
Gets or sets the path pattern for generating file names.
public string PathPattern { get; set; }
Property Value
Remarks
The pattern supports tokens that are replaced with values from the image metadata. Tokens are case-sensitive and must be enclosed in curly braces.
Examples:
- "{Id}.{Extension}" produces "12345678.png"
- "{Username}/{Id}.{Extension}" produces "ArtistName/12345678.png"
- "{BaseModel}/{Username}/{Id}.{Extension}" produces "SDXL 1.0/ArtistName/12345678.png"