{"id":24629473,"url":"https://github.com/sharpjs/sharp.blobstorage","last_synced_at":"2026-04-13T17:33:29.046Z","repository":{"id":68403052,"uuid":"122656222","full_name":"sharpjs/Sharp.BlobStorage","owner":"sharpjs","description":"A very simple .NET interface to blob storage.","archived":false,"fork":false,"pushed_at":"2021-01-01T17:19:07.000Z","size":157,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-25T15:06:25.174Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sharpjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-23T18:10:29.000Z","updated_at":"2022-05-31T03:57:13.000Z","dependencies_parsed_at":"2023-09-06T00:00:35.761Z","dependency_job_id":null,"html_url":"https://github.com/sharpjs/Sharp.BlobStorage","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpjs%2FSharp.BlobStorage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpjs%2FSharp.BlobStorage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpjs%2FSharp.BlobStorage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharpjs%2FSharp.BlobStorage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sharpjs","download_url":"https://codeload.github.com/sharpjs/Sharp.BlobStorage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244554042,"owners_count":20471172,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-25T06:13:01.637Z","updated_at":"2026-04-13T17:33:29.007Z","avatar_url":"https://github.com/sharpjs.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sharp.BlobStorage\n\nA very simple .NET interface to blob storage.  Supports these providers:\n\n- The file system\n- Azure Storage blob containers\n\n## Status\n\n[![Build](https://github.com/sharpjs/Sharp.BlobStorage/workflows/Build/badge.svg)](https://github.com/sharpjs/Sharp.BlobStorage/actions)\n\nAvailable as NuGet packages:\n\n- [Sharp.BlobStorage](https://www.nuget.org/packages/Sharp.BlobStorage)\u003cbr/\u003e\n  [![NuGet](https://img.shields.io/nuget/v/Sharp.BlobStorage.svg)](https://www.nuget.org/packages/Sharp.BlobStorage)\n  [![NuGet](https://img.shields.io/nuget/dt/Sharp.BlobStorage.svg)](https://www.nuget.org/packages/Sharp.BlobStorage)\n\n- [Sharp.BlobStorage.Azure](https://www.nuget.org/packages/Sharp.BlobStorage.Azure)\u003cbr/\u003e\n  [![NuGet](https://img.shields.io/nuget/v/Sharp.BlobStorage.Azure.svg)](https://www.nuget.org/packages/Sharp.BlobStorage.Azure)\n  [![NuGet](https://img.shields.io/nuget/dt/Sharp.BlobStorage.Azure.svg)](https://www.nuget.org/packages/Sharp.BlobStorage.Azure)\n\nVersions:\n- 0.1.0 has been used in production for several years with no issues reported.\n- 1.0.0 is in development.\n\n## Usage\n\nFirst, add the appriate `using` directives:\n\n```csharp\nusing Sharp.BlobStorage;       // always\nusing Sharp.BlobStorage.File;  // to use the filesystem\nusing Sharp.BlobStorage.Azure; // to use Azure Storage\n```\n\nNext, create the appropriate blob storage client.  To store blobs as files in\nthe computer's file system:\n\n```csharp\nprivate IBlobStorage CreateBlobStorage()\n{\n    var configuration = new FileBlobStorageConfiguration\n    {\n        Path = @\"C:\\Blobs\"\n    };\n    \n    return new FileBlobStorage(configuration);\n}\n```\n\nTo store blobs in an Azure Storage blob container:\n\n```csharp\nprivate IBlobStorage CreateBlobStorage()\n{\n    var configuration = new AzureBlobStorageConfiguration\n    {\n        ConnectionString = @\"...an Azure Storage connection string...\",\n        ContainerName    = @\"blobs\"\n    };\n    \n    return new AzureBlobStorage(configuration);\n}\n```\n\nAnd, to create the client:\n\n```csharp\nvar storage = CreateBlobStorage();\n```\n\n### Operations\n\nThe Sharp.BlobStorage `IBlobStorage` interface exposes a minimal set of\noperations, each with synchronous and asynchronous variants.\n\nSynchronous | Asynchronous  | Description\n------------|---------------|------------\n`Put`       | `PutAsync`    | Creates (uploads) a blob\n`Get`       | `GetAsync`    | Gets (downloads) a blob\n`Delete`    | `DeleteAsync` | Deletes a blob\n\n`IBlobStorage` methods identify each blob by a semi-random URI generated when\nthe blob is created.  Blob URIs are *not* specific to an underlying storage\nprovider.  Rather, blob URIs are generalized so that they can identify the same\nblobs regardless of provider configuration changes.\n\nThe methods represent blob content as `Stream` objects, rather than strings\nor byte arrays.  This is a conscious design decision intended to ~~force~~\nencourage application authors to use a streaming approach when dealing with\nblobs.  Streaming enables applications to handle arbitrarily large blobs without\nexhausting available memory.\n\n#### Creating a Blob\n\nGiven a readable `Stream` object and a filename extension, it is possible to\ncreate (upload) a new blob storing the content of the stream.\n\n```csharp\nvar uri = storage.Put(stream, \".txt\");\n\n// or\n\nvar uri = await storage.PutAsync(stream, \".txt\");\n```\n\nThe caller should save the returned URI, as it is the only way to identify the\nblob.\n\n`Put` and `PutAsync` do not dispose `stream`.\n\n#### Retrieving a Blob\n\nGiven a blob URI, it is possible to retrieve (download) the blob's content as a\nreadable `Stream` object.\n\n```csharp\nusing (var stream = storage.Get(uri))\n{\n    // read stream in here\n}\n\n// or\n\nusing (var stream = await storage.GetAsync(uri))\n{\n    // read stream in here\n}\n```\n\nThe caller should ensure that the stream returned by `Get` and `GetAsync` is\ndisposed when done.\n\n#### Deleting a Blob\n\nGiven a blob URI, it is possible to delete the blob.\n\n```csharp\nvar existed = storage.Delete(uri);\n\n// or\n\nvar existed = await storage.DeleteAsync(uri);\n```\n\nThe method succeeds regardless of whether the blob exists.  If the blob exists\nand is deleted, the method returns `true`; otherwise, `false`.\n\n## Notes\n\n- To test Azure storage support, a working `docker` command is required.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharpjs%2Fsharp.blobstorage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsharpjs%2Fsharp.blobstorage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharpjs%2Fsharp.blobstorage/lists"}