ByteShelfCommon 2.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ByteShelfCommon --version 2.2.0
                    
NuGet\Install-Package ByteShelfCommon -Version 2.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ByteShelfCommon" Version="2.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ByteShelfCommon" Version="2.2.0" />
                    
Directory.Packages.props
<PackageReference Include="ByteShelfCommon" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ByteShelfCommon --version 2.2.0
                    
#r "nuget: ByteShelfCommon, 2.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ByteShelfCommon@2.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ByteShelfCommon&version=2.2.0
                    
Install as a Cake Addin
#tool nuget:?package=ByteShelfCommon&version=2.2.0
                    
Install as a Cake Tool

ByteShelfCommon

The contract shared by the ByteShelf server and its clients: the request and response types they exchange, the rules for paths and shelf names, and source-generated JSON. Targets net8.0 and is AOT-compatible.

Types

Type What it is
ShelfInfo A shelf with its quota and usage.
CreateShelfRequest, UpdateShelfRequest Creates a shelf, and replaces its name and quota.
ShelfFile A file's record: id, path, size, content type, SHA-256, timestamps, description, and whether its contents are encrypted (Encrypted).
SetDescriptionRequest, FileDescription Setting a file's description, and its rules.
FileCriteria Which of a shelf's files a search looks at: the directory, text, type, sizes, times, SHA-256, whether it has a description, and what the server read from the contents (taken times, a GPS position, durations, page counts), checked by NormalizeCriteria. Both searches below take their criteria from it.
FileSearch, FileSearchResults The files that meet the criteria, a page at a time by path, and one page of them.
DuplicateSearch, DuplicateSearchResults, DuplicateGroup, DuplicateCursor The groups of plain, non-empty files with the same contents among those that meet the criteria, a page of groups at a time, most repeated bytes first, and where a page ended. DuplicateSearchResults.Page groups, orders and pages them, for the server and the in-memory client alike.
DownloadLink A link to a file's contents that works without a token until it runs out or is revoked, with its id, and the bounds of its lifetime (Lifetime: a day by default, at most 7 days).
UploadLink, CreateUploadLinkRequest, NormalizedUploadLinkRequest A link that stores one file sent to it without a token, with its id, and asking for one (Lifetime: 15 minutes by default, at most 24 hours).
ShelfLink, ShelfLinkKind, LinkMaker, LinkMakerKind A download or upload link as listed, to revoke by its id: what it reaches, who made it, and when it runs out.
FileMetadata What the server read from a file's contents (when and where a photo was taken, the camera, a video's length, a PDF's title and pages), and whether it reads that file at all (Readable).
LinkLifetime One kind of link's lifetime rule: its default, its bounds and Normalize.
FileEncryption, EncryptedFolder, PathEncryption, SetFolderEncryptionRequest Password encryption: how an age file starts, an encrypted directory's check text, an encrypted directory with its check, what a path is encrypted under, and encrypting a directory.
ShelfDirectory, DirectoryListing, ListedDirectory A directory and whether it is encrypted (Encrypted), what one holds, and a directory in a listing with the size and count of the files under it, and how many are encrypted.
TreeQuery, DirectoryTree, TreeEntry What to list of everything under a directory (a depth, a page), one page of it, and one entry of a page, a directory or a file.
StoredOrder The order names and paths are listed in: by code point, as the server's database sorts them.
CreateDirectoryRequest, MoveRequest Creates a directory; moves or renames a file or directory.
StartUploadRequest, StartContentSwapRequest, UploadSession Starting and following a resumable upload, of a new file or swapping a file's contents in place.
TrashEntry, TrashEntryKind A deletion that can still be restored.
ShelfAccessGrant, SetShelfAccessRequest, ShelfAccessPermission A user's access to a shelf, and giving it.
ShelfKeyInfo, CreateShelfKeyRequest, CreatedShelfKey, ShelfKeyPermission A program's key to one shelf, and creating one.
ShelfKeys The X-Api-Key header a key is sent in, and the secret's prefix, which also tells a key sent as the bearer token from a session token.
EntryReference Names a file or directory by path or by id; a path or an id converts to one.
UserInfo, CreateUserRequest, UpdateRolesRequest, UpdatePasswordRequest, UserRoles Users and changing them.
RequestPasswordResetRequest, CompletePasswordResetRequest Asking for a reset link, and using it.
SignInRequest, SessionTokens, RefreshTokenRequest Signing in, refreshing and signing out at /api/auth.
ReplicationStatus, ReplicaInfo, ReplicationSourceInfo, PairingCodeResponse, PairWithPrimaryRequest, PromoteResponse A server's replicas or the primary it follows, pairing one, and promoting it.
ErrorResponse, ErrorCodes Every error body, with a machine-readable code.
UploadLimits The server's limits, such as the largest chunk.

Rules

  • ShelfPath normalizes and validates paths inside a shelf: a leading /, names separated by /, no empty names, ., .., backslashes, control or invisible formatting characters, and every name in Unicode normalization form C. Names that are valid on a shelf are not always valid file names on every operating system (Windows refuses CON and a trailing dot), so a client that writes files to disk maps them itself.
  • ShelfName validates shelf names: 1 to 63 lowercase letters, digits, -, _ and ., starting with a letter or digit. ShelfSettings adds that a quota cannot be negative.
  • FileDescription trims a description and puts it in normalization form C; blank is none, and it holds at most 2,000 characters, counted as code points.
  • FileCriteria.NormalizeCriteria checks the criteria: sizes, durations and page counts not negative, a duration a finite number of seconds, ranges not empty (a time range includes its start and excludes its end; sizes, durations and page counts are inclusive), a content type that is one media type or a family such as image/*, and a SHA-256 of 64 hex digits. FileSearch.Normalize adds a page of 1 to 1,000 files (100 by default), and DuplicateSearch.Normalize a page of 1 to 1,000 groups (100 by default). Fold is how search compares text, both sides: normalization form C, then invariant lowercase.
  • ContentHash checks a SHA-256 named in a request (64 hex digits, in either case) and answers it lowercase, as the server stores it.
  • ContentTypes checks the media type stored with a file, and ForUpload picks it when an upload gives none: the one its path's extension names, else application/octet-stream.
  • NormalizedUploadLinkRequest.Create checks an upload link's request: a file's path (never the root), a description, and a lifetime within UploadLink.Lifetime.
  • PasswordPolicy checks a password, UserFields an email and display name, DisplayText short names such as a key's, and UserRoles a user's roles.
  • The server applies every rule, and so does the in-memory client in ByteShelfClient. The HTTP client applies ShelfPath, ContentHash, ContentTypes, FileDescription, FileSearch, DuplicateSearch, the link lifetimes and NormalizedUploadLinkRequest before sending, since they shape the request, and leaves the rest to the server.

JSON

ByteShelfCommon.Serialization.ByteShelfJsonContext serializes every type without reflection, in camelCase like the server. Enums are written as camelCase strings and read back ignoring case, by CamelCaseEnumConverter, set on each enum type so the server and every client agree.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on ByteShelfCommon:

Package Downloads
ByteShelfClient

Client for ByteShelf, a self-hosted file store: an interface over shelves, files and directories, an HTTP implementation, and an in-memory one for tests.

EasyReasy.ByteShelfProvider

Enables resources from ByteShelf for EasyReasy

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.1 44 11/26/2026
4.0.0 55 11/25/2026
3.1.0 77 11/20/2026
3.0.0 69 11/20/2026
2.2.0 186 11/20/2026
2.1.0 114 11/19/2026
2.0.0 150 11/15/2026
1.3.0 559 10/12/2025
1.2.2 490 7/14/2025
1.2.1 252 7/13/2025
1.2.0 239 7/13/2025
1.1.1 257 7/11/2025
1.1.0 281 7/3/2025
1.0.0 267 6/18/2025

Adds ErrorCodes.RangeNotSatisfiable (range_not_satisfiable), for a ranged read starting at or past the end of a file, and ErrorCodes.ContentChanged (content_changed), for a read whose file no longer holds the contents it expected, both for ByteShelfClient 2.2.0's ranged reads. ContentHash checks a SHA-256 named in a request, the rule FileCriteria already applied. See https://github.com/AdamTovatt/byte-shelf/blob/client-v2.2.0/ByteShelfCommon/README.md