Realm.LFS 1.1.0

dotnet add package Realm.LFS --version 1.1.0
NuGet\Install-Package Realm.LFS -Version 1.1.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="Realm.LFS" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Realm.LFS --version 1.1.0
#r "nuget: Realm.LFS, 1.1.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.
// Install Realm.LFS as a Cake Addin
#addin nuget:?package=Realm.LFS&version=1.1.0

// Install Realm.LFS as a Cake Tool
#tool nuget:?package=Realm.LFS&version=1.1.0

Realm LFS

Realm LFS (large file storage) is an extension of the Realm.NET SDK that exposes an abstraction for interacting with binary files that are transparently uploaded to a 3rd party service (e.g. S3/Azure Blob Storage) and their URL is subsequently updated in the Realm object for other clients to consume.


Using binary data (i.e. byte[] properties) with Realm is supported but very inefficient. The recommended approach is to upload the data to a file hosting service and store just the URL in the Realm object, but doing so requires internet connection and defeats one of the main advantages of using Realm. The purpose of this library is to abstract as much as possible the uploading part and expose an interface that is as close as possible to the Realm API of interacting with data.


For the most part, just replace byte[] properties with FileData ones:

public class Recipe : RealmObject
    public string Name { get; set; }

    public string Summary { get; set; }

    public IList<Ingredient> Ingredients { get; set; }

    // Replace this
    public byte[] Photo { get; set; }

    // with this
    public FileData Photo { get; set; }

To initialize the SDK, the minimum configuration you need to do is to configure the remote manager factory:

LFSManager.Initialize(new LFSOptions
    RemoteManagerFactory = (config) => new FunctionsStorageManager(config, "MyDataFunction")

The FileData class can be constructed from a Stream - if you already have a byte[], that can be used to create a MemoryStream.

When displaying an image from a FileData, the code should look something like:

public void PopulateImage(Recipe recipe)
    switch (recipe.Photo.Status)
        case DataStatus.Local:
            var imagePath = recipe.Photo.LocalUrl;
            if (File.Exists(imagePath))
                // we are the device that created the image - display it from disk
                MyImage.ImageSource = new FileImageSource(imagePath);
                // this image was created on another device, but it hasn't uploaded it yet
                // to S3. Display a placeholder until the status changes to Remote
                MyImage.ImageSource = placeHolderImage;
        case DataStatus.Remote:
            MyImage.ImageSource = new ImageSource(recipe.Photo.Url);


There are 3 supplied implementations of RemoteStorageManager, each shipped in a separate package:

  1. Realm.LFS.Functions provides a file manager that calls an Atlas Function to obtain a pre-signed url. Then it uploads data to the retried url.
  2. Realm.LFS.S3 uses the S3 SDK to upload files to an S3 bucket.
  3. Realm.LFS.Azure uses the Azure SDK to upload files to Azure Blob Storage.

If you use another service or have your own web server that can process the file uploads, you need to supply your own implementation of RemoteStorageManager.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Realm.LFS:

Package Downloads

A RemoteStorageManager for Realm.LFS that uploads files to AWS S3.


A RemoteStorageManager for Realm.LFS that calls an Atlas Function to obtain a pre-signed url for file uploads.


A RemoteStorageManager for Realm.LFS that uploads files to Azure blob storage.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 258 8/2/2023
1.0.0 216 7/24/2023

## 1.1.0 (2023-08-02)

### Breaking Changes
* Renamed `FileManager` to `LFSManager`.
* Renamed `RemoteFileManager` to `RemoteStorageManager`.
* Renamed `FunctionsFileManager` to `AtlasFunctionsStorageManager`.
* Renamed `S3FileManager` to `S3StorageManager`.
* Renamed `AzureFileManager` to `AzureStorageManager`.

### Fixed
* Fixed Realm.LFS.S3 readme.

## 1.0.0 (2023-07-24)

### Enhancements
* Updated to support Realm 10.x and newer.