Altinn.FileAnalyzers
9.0.0-preview.1
dotnet add package Altinn.FileAnalyzers --version 9.0.0-preview.1
NuGet\Install-Package Altinn.FileAnalyzers -Version 9.0.0-preview.1
<PackageReference Include="Altinn.FileAnalyzers" Version="9.0.0-preview.1" />
<PackageVersion Include="Altinn.FileAnalyzers" Version="9.0.0-preview.1" />
<PackageReference Include="Altinn.FileAnalyzers" />
paket add Altinn.FileAnalyzers --version 9.0.0-preview.1
#r "nuget: Altinn.FileAnalyzers, 9.0.0-preview.1"
#:package Altinn.FileAnalyzers@9.0.0-preview.1
#addin nuget:?package=Altinn.FileAnalyzers&version=9.0.0-preview.1&prerelease
#tool nuget:?package=Altinn.FileAnalyzers&version=9.0.0-preview.1&prerelease
Altinn File Analyzers
This library contains code for doing deep file analysis based the actual binary data of files uploaded to an instance in Altinn 3. The implementation is two folded, one part that analyses and another part that validates against the analysis results. The reasoning for this split is to be able to use only the analyzer and extract metadata without validating. In addition it will be simpler to configure validators against a standardized result set rather than embed that into the analysis code.
The Getting started section describes the basic steps required in order to use this package within an Altinn 3 application. For a more comprehensive description of file analyzers in Altinn 3 please see https://docs.altinn.studio/app/development/logic/validation/files/. <hr> <br/>
Getting started using the package
This guide assumes you have an existing Altinn 3 application. If not please see https://docs.altinn.studio/app/getting-started/create-app/ to get started.
Add reference to Altinn.FileAnalyzers nuget package
Open command line to the repo of your application and navigate to the App folder where the App.csproj file is located and run the following command:nuget install Altinn.FileAnalyzersRegister the analyzers you would like to use Each analyzer/validator has it's own method for registering required services. Se table below for available analyzer.
services.AddMimeTypeValidation();Configure the the analyzer for the datatype it should be used for The analyzer is configured on a per datatype basis and will only run against the configured datatype. The example below configures the mime type analyzer and it's corresponding validator.
{ "id": "08112113-cc3a-4d35-a8d2-bfba53a1ddfd", "allowedContentTypes": ["image/jpeg", "application/pdf"], "taskId": "Task_1", "maxSize": 25, "maxCount": 1, "minCount": 1, "enablePdfCreation": false, "enabledFileAnalysers": [ "mimeTypeAnalyser" ], "enabledFileValidators": [ "mimeTypeValidator" ] }
Available analyzers and their corresponding validators
| Analyzer Id | Validator Id | Description |
|---|---|---|
| mimeTypeAnalyser | mimeTypeValidator | Checks if a file is actually the MIME type it claims to be. This uses the Mime Detective library to determine the mime type. |
Automated tests
Contributing
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Altinn.App.Core (>= 9.0.0-preview.5)
- Mime-Detective (>= 25.8.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 9.0.0-preview.1 | 45 | 9/9/2026 |
| 8.0.0 | 7,427 | 9/18/2025 |
| 8.0.0-rc.1 | 604 | 7/2/2025 |
| 0.5.0 | 5,165 | 6/16/2023 |
| 0.5.0-preview.3 | 605 | 6/8/2023 |
| 0.5.0-preview.2 | 251 | 6/5/2023 |
| 0.5.0-preview.1 | 261 | 6/5/2023 |