The readme contains these instructions for redirecting the workspace, using ArtifactStorageOptions.WorkspacePathFormatter to override the path:
var workspaceRoot = Path.Combine(Path.GetTempPath(), "markitdown", "workspaces");
var options = new MarkItDownOptions
{
ArtifactStorage = ArtifactStorageOptions.Default with
{
WorkspacePathFormatter = name => Path.Combine(workspaceRoot, name),
DeleteOnDispose = false // keep the workspace directory after conversion
},
SegmentOptions = SegmentOptions.Default with
{
Image = SegmentOptions.Default.Image with
{
KeepArtifactDirectory = true
}
}
};
Directory.CreateDirectory(workspaceRoot);
await using var client = new MarkItDownClient(options);
await using var result = await client.ConvertAsync("policy.pdf");
However, before the call to the WorkspacePathFormatter is invoked on line 36:
|
var directoryPath = storageOptions.WorkspacePathFormatter?.Invoke(workspaceName) |
On lines 27-32, if the StorageFactory was not setup on the options, a default path will be returned:
|
if (storageFactory is null) |
|
{ |
|
var localDirectory = BuildLocalWorkspacePath(streamInfo, segmentOptions.Image); |
|
var deleteOnDispose = storageOptions.DeleteOnDispose && !segmentOptions.Image.KeepArtifactDirectory; |
|
return ArtifactWorkspace.Create(localDirectory, deleteOnDispose, ensureCreated: true); |
|
} |
Using ManagedCode.MarkItDown 10.0.6
The readme contains these instructions for redirecting the workspace, using
ArtifactStorageOptions.WorkspacePathFormatterto override the path:However, before the call to the WorkspacePathFormatter is invoked on line 36:
markitdown/src/MarkItDown/Conversion/ArtifactWorkspaceFactory.cs
Line 36 in bbdf4a3
On lines 27-32, if the StorageFactory was not setup on the options, a default path will be returned:
markitdown/src/MarkItDown/Conversion/ArtifactWorkspaceFactory.cs
Lines 27 to 32 in bbdf4a3
Using ManagedCode.MarkItDown 10.0.6