bagit.net is a C# implementation of the BagIt specification (RFC 8493).
It allows you to create BagIt bags—structured file collections with checksums for reliable storage and transfer of digital content.
It currently consists of a core library (bagit.net) and a CLI application (bagit.net.cli) for Linux, MacOS, and Windows.
⚠️ Note: This project is in early development. It currently supports the creation and validation of BagIt-formatted bags. There is currently no error handling in place and will crash if an error is encountered. See the roadmap for current project status
Create a BagIt-formatted bag from a directory.
| Option | Description |
|---|---|
--algorithm |
Specify the checksum algorithm to use: md5, sha1, sha256 (default), sha384, or sha512. |
--log |
Specify the location to write logging (default: stdout). |
--tag-file |
Specify the location of an external tag-file to include in bag-info.txt |
Usage:
# Create a bag with default SHA-256 checksums
bagit.net create /path/to/directory
# Create a bag using MD5 checksums
bagit.net create --algorithm md5 /path/to/directory
# Log to a file
bagit.net create --log bagit.net.log /path/to/directory
#Include tag metadata from external file in bag-info.txt
bagit.net create --tag-file /path/to/tag-file.txt /path/to/directoryValidate a BagIt-formatted bag.
| Option | Description |
|---|---|
--fast |
Validate the bag based on payload-oxum only. |
--complete |
Validate the bag based on completeness only. |
--log |
Specify the location to write logging (default: stdout). |
Usage:
# Validate a bag
bagit.net validate /path/to/bag
# Validate a bag with logging to file
bagit.net validate --log bagit.net.log /path/to/bag
# Fast validation
bagit.net validate --fast /path/to/bag
# Completeness Only validation
bagit.net validate --complete /path/to/bagnote: setting both --fast and --complete flags will cause the application to exit
manage tag manifests in existing bag.
| Option | Description |
|---|---|
--add |
add a new key and value to bag-info.txt |
--set |
replace the value of a key in bag-info.txt |
--delete |
remove a line from bag-info.txt by the key |
--view |
display the contents of bag-it.txt |
Usage:
#add a key-value pair to bagit.txt
bagit.net manage --add "External-Identifier=ID001" /path/to/bag
#replace a value for a given key in bagit.txt
bagit.net manage --set "External-Identifier=ID002" /path/to/bag
#remove a key and value
bagit.net manage --delete "External-Identifier" /path/to/bag
#print contents of bag-info.txt to stdout
bagit.net manage --view /path/to/bagDisplay help information.
Usage:
bagit.net helpTip: Including
--helpor-hwith any command will print the help screen.
wget https://github.com/dmnyu/bagit.net/releases/download/v0.2.6-alpha/bagit.net.cli-v0.2.6-alpha-linux-x64.tgz
tar xvzf bagit.net.cli-v0.2.6-alpha-linux-x64.tgz
cd bagit.net
sudo ./install.sh
bagit.net --helpLinux / SELinux Notes:
bagit.net single-file self-contained binaries require the ability to create and execute temporary files at runtime.
On RHEL/CentOS systems with SELinux or noexec restrictions on /tmp, these binaries may not run.
Invoke-WebRequest -Uri https://github.com/dmnyu/bagit.net/releases/download/v0.2.6-alpha/bagit.net.cli-v0.2.6-alpha-win-x64.zip -OutFile bagit.net.cli-v0.2.6-alpha-win-x64.zip
Expand-Archive bagit.net.cli-v0.2.6-alpha-win-x64.zip -DestinationPath .
cd .\bagit.net
.\bagit.net.exe --help
.\install.ps1
%LOCALAPPDATA%\bagit.net\bagit.net --versionTip: After installation on Windows, you can run
bagit.netfrom any directory by adding%LOCALAPPDATA%\bagit.netto your userPATH.
wget https://github.com/dmnyu/bagit.net/releases/download/v0.2.6-alpha/bagit.net.cli-v0.2.6-alpha-macos-arm64.tgz
tar xvzf bagit.net.cli-v0.2.6-alpha-macos-arm64.tgz
cd bagit.net
sudo ./install.sh
bagit.net --helpnote This is an automated build from Github Actions, it is not tested.
- The CLI requires the .NET 9 runtime to be installed on your system.
- On Linux and MacOS, the default install path is
/usr/local/bin/bagit.net. - On Windows, the default install path is
%LOCALAPPDATA%\bagit.net\bagit.net.exe. - For CI/CD or scripting, you can run the CLI directly from the extracted directory without installing.