{"id":23433740,"url":"https://github.com/mustaddon/distributedfilestorage","last_synced_at":"2025-04-13T01:08:26.451Z","repository":{"id":115863821,"uuid":"413101789","full_name":"mustaddon/DistributedFileStorage","owner":"mustaddon","description":".NET Distributed file storage","archived":false,"fork":false,"pushed_at":"2024-11-22T06:06:37.000Z","size":90,"stargazers_count":11,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-13T01:08:23.220Z","etag":null,"topics":["blob-storage","csharp","database","dotnet","dotnet-core","file-storage","filestorage","storage"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mustaddon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-10-03T14:31:47.000Z","updated_at":"2024-11-22T06:23:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"95869795-c820-41a0-a94a-d1a0ffaf7f15","html_url":"https://github.com/mustaddon/DistributedFileStorage","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustaddon%2FDistributedFileStorage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustaddon%2FDistributedFileStorage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustaddon%2FDistributedFileStorage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mustaddon%2FDistributedFileStorage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mustaddon","download_url":"https://codeload.github.com/mustaddon/DistributedFileStorage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650762,"owners_count":21139681,"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":["blob-storage","csharp","database","dotnet","dotnet-core","file-storage","filestorage","storage"],"created_at":"2024-12-23T11:27:16.761Z","updated_at":"2025-04-13T01:08:26.430Z","avatar_url":"https://github.com/mustaddon.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DistributedFileStorage [![NuGet version](https://badge.fury.io/nu/DistributedFileStorage.svg)](http://badge.fury.io/nu/DistributedFileStorage)\nDistributed file storage\n\n\n## Features\n* Storing metadata in the database (SQL/NoSQL)\n* Storing files in the file system\n* Deduplication of files by content\n* Distributed storage (multiple disks)\n\n\n\n## Example: Simple console app\n```\ndotnet new console --name \"DfsExample\"\ncd DfsExample\ndotnet add package DistributedFileStorage.EntityFrameworkCore\ndotnet add package Microsoft.EntityFrameworkCore.SqlServer\n```\n\nprogram.cs:\n```C#\nusing DistributedFileStorage;\nusing Microsoft.EntityFrameworkCore;\nusing Microsoft.Extensions.DependencyInjection;\n\n\n// add services to the container\nvar services = new ServiceCollection()\n    .AddDfsEfc\u003cstring\u003e(options =\u003e\n    {\n        // add database provider \n        options.Database.ContextConfigurator = (db) =\u003e db.UseSqlServer(\"Data Source=(localdb)\\\\MSSQLLocalDB;Initial Catalog=DfsDatabase;Integrated Security=True;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False\");\n\n        // add path construction algorithm \n        var rnd = new Random();\n        options.FileStorage.PathBuilder = (fileId) =\u003e Path.GetFullPath($@\"_dfs\\fake_disk_{rnd.Next(1, 3)}\\{DateTime.Now:yyyy\\\\MM\\\\dd}\\{fileId}\");\n    })\n    .BuildServiceProvider();\n\n\nvar dfs = services.GetRequiredService\u003cIDistributedFileStorage\u003cstring\u003e\u003e();\n\n// upload\nusing var uploadFile = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(\"test text\"));\nvar fileId = await dfs.Add(uploadFile, $\"example.txt\", \"my metadata\");\n\n// get info\nvar fileInfo = await dfs.GetInfo(fileId);\nConsole.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(fileInfo));\n\n// download \nusing var downloadFile = File.Create(\"example.txt\");\nawait foreach (var chunk in dfs.GetContent(fileId))\n    await downloadFile.WriteAsync(chunk);\n```\n\n\n[More examples...](https://github.com/mustaddon/DistributedFileStorage/tree/main/Examples/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmustaddon%2Fdistributedfilestorage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmustaddon%2Fdistributedfilestorage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmustaddon%2Fdistributedfilestorage/lists"}