forked from microsoft/markitdown
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
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:
markitdown/src/MarkItDown/Conversion/ArtifactWorkspaceFactory.cs
Lines 27 to 32 in bbdf4a3
| 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels