{"id":19174997,"url":"https://github.com/losttech/pclstorage.desktop","last_synced_at":"2026-02-10T16:31:35.853Z","repository":{"id":124319928,"uuid":"86414000","full_name":"losttech/PCLStorage.Desktop","owner":"losttech","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-02T07:55:32.000Z","size":1343,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-19T10:45:22.262Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"ms-pl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/losttech.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":"2017-03-28T04:13:42.000Z","updated_at":"2017-03-28T04:13:59.000Z","dependencies_parsed_at":"2024-06-21T03:53:32.378Z","dependency_job_id":"436396ea-c35c-4bf4-a3ac-a916bd9ff499","html_url":"https://github.com/losttech/PCLStorage.Desktop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/losttech/PCLStorage.Desktop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/losttech%2FPCLStorage.Desktop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/losttech%2FPCLStorage.Desktop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/losttech%2FPCLStorage.Desktop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/losttech%2FPCLStorage.Desktop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/losttech","download_url":"https://codeload.github.com/losttech/PCLStorage.Desktop/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/losttech%2FPCLStorage.Desktop/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270268106,"owners_count":24555548,"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","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2024-11-09T10:20:18.323Z","updated_at":"2026-02-10T16:31:35.818Z","avatar_url":"https://github.com/losttech.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PCL Storage\n\n![PCL Storage](https://dsplaisted.blob.core.windows.net/oss/pickles_64.png)\n\nPCL Storage provides a consistent, portable set of local file IO APIs for .NET,\nWindows Phone, Windows Store, Xamarin.iOS, Xamarin.Android, and Silverlight.\nThis makes it easier to create cross-platform .NET libraries and apps.\n\nHere is a sample showing how you can use PCL Storage to create a folder and\nwrite to a text file in that folder:\n\n```C#\npublic async Task PCLStorageSample()\n{\n    IFolder rootFolder = FileSystem.Current.LocalStorage;\n    IFolder folder = await rootFolder.CreateFolderAsync(\"MySubFolder\",\n        CreationCollisionOption.OpenIfExists);\n    IFile file = await folder.CreateFileAsync(\"answer.txt\",\n        CreationCollisionOption.ReplaceExisting);\n    await file.WriteAllTextAsync(\"42\");\n}\n```\n\n## Installation\n\nInstall the [PCLStorage NuGet Package](http://nuget.org/packages/pclstorage).\n\nIf you reference the package from a Portable Class Library, you will also need\nto reference the package from each platform-specific app. This is because the\nPortable Class Library version of PCL Storage doesn't contain the actual\nimplementation of the storage APIs (because it differs from platform to\nplatform), so referencing the package from an app will ensure that the\nplatform-specific version of PCL Storage is included in the app and used at\nruntime.\n\n## Background information\n\nDifferent .NET platforms have different APIs for accessing the file system or\nan app-local persisted storage area. The full .NET Framework provides the\nstandard file and directory APIs (in the System.IO namespace), Silverlight and\nWindows Phone provide isolated storage APIs, and WinRT provides storage APIs in\nthe Windows.Storage namespace.\n\nThese differing APIs make it harder to write cross-platform code. Traditionally,\nyou could handle this via conditional compilation. However, that means you can't\ntake advantage of Portable Class Libraries, and in any case may not scale well\nas your code gets complex (and especially because for WinRT you need to use\nasync APIs).\n\nAlternatively, you can create an abstraction for the functionality you need\nacross platforms, and implement the abstraction for each platform you need to\nuse. This approach allows you to use Portable Class Libraries, and in general\nmakes your code cleaner and more maintainable by isolating the platform-specific\npieces instead of having them sprinkled arbitrarily throughout your code.\n\nWriting an abstraction layer is a bit of a barrier to entry to writing\ncross-platform code, and there's no reason everyone should have to do it\nseparately for functionality as commonly needed as local file IO. PCL Storage\naims to provide a common abstraction that is easy to take advantage of.\n\n## APIs\n\n[API documentation for PCL\nStorage](http://www.nudoq.org/#!/Packages/PCLStorage/PCLStorage/FileSystem) can\nbe found at [NuDoq](http://www.nudoq.org).  The definitions for the main\nAPIs in PCL Storage are below.\n\nThe primary APIs in PCL Storage are the [IFile][], [IFolder][], and\n[IFileSystem][] interfaces. The APIs should be mostly self-explanatory and\nshould feel very familiar if you have used the WinRT storage APIs.\n\n[IFile]: http://www.nudoq.org/#!/Packages/PCLStorage/PCLStorage.Abstractions/IFile \"IFile documentation\"\n[IFolder]: http://www.nudoq.org/#!/Packages/PCLStorage/PCLStorage.Abstractions/IFolder \"IFolder documentation\"\n[IFileSystem]: http://www.nudoq.org/#!/Packages/PCLStorage/PCLStorage.Abstractions/IFileSystem \"IFileSystem documentation\"\n\nThe [IFileSystem][] interface is the main API entry point. You can get an instance\nof the implementation for the current platform with the [FileSystem.Current][]\nproperty.\n\n[FileSystem.Current]: http://www.nudoq.org/#!/Packages/PCLStorage/PCLStorage/FileSystem/P/Current \"FileSystem.Current documentation\"\n\n```C#\nnamespace PCLStorage\n{\n    public static class FileSystem\n    {\n        public static IFileSystem Current { get; }\n    }\n\n    public interface IFileSystem\n    {\n        IFolder LocalStorage { get; }\n        IFolder RoamingStorage { get; }\n\n        Task\u003cIFile\u003e GetFileFromPathAsync(string path);\n        Task\u003cIFolder\u003e GetFolderFromPathAsync(string path);\n    }\n\n    public enum CreationCollisionOption\n    {\n        GenerateUniqueName = 0,\n        ReplaceExisting = 1,\n        FailIfExists = 2,\n        OpenIfExists = 3,\n    }\n\n    public interface IFolder\n    {\n        string Name { get; }\n        string Path { get; }\n\n        Task\u003cIFile\u003e CreateFileAsync(string desiredName, CreationCollisionOption option);\n        Task\u003cIFile\u003e GetFileAsync(string name);\n        Task\u003cIList\u003cIFile\u003e\u003e GetFilesAsync();\n\n        Task\u003cIFolder\u003e CreateFolderAsync(string desiredName,\n            CreationCollisionOption option);\n        Task\u003cIFolder\u003e GetFolderAsync(string name);\n        Task\u003cIList\u003cIFolder\u003e\u003e GetFoldersAsync();\n\n        Task\u003cExistenceCheckResult\u003e CheckExistsAsync(string name,\n            CancellationToken cancellationToken = default(CancellationToken));\n\n        Task DeleteAsync();\n    }\n\n    public enum FileAccess\n    {\n        Read,\n        ReadAndWrite\n    }\n\n    public interface IFile\n    {\n        string Name { get; }\n        string Path { get; }\n\n        Task\u003cStream\u003e OpenAsync(FileAccess fileAccess);\n        Task DeleteAsync();\n        Task RenameAsync(string newName,\n          NameCollisionOption collisionOption = NameCollisionOption.FailIfExists,\n          CancellationToken cancellationToken = default(CancellationToken));\n        Task MoveAsync(string newPath,\n          NameCollisionOption collisionOption = NameCollisionOption.ReplaceExisting,\n          CancellationToken cancellationToken = default(CancellationToken));\n    }\n\n    public static class PortablePath\n    {\n        public static char DirectorySeparatorChar { get; }\n        public static string Combine(params string[] paths);\n    }\n    public static class FileExtensions\n    {\n        public static async Task\u003cstring\u003e ReadAllTextAsync(this IFile file)\n        public static async Task WriteAllTextAsync(this IFile file, string contents);\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flosttech%2Fpclstorage.desktop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flosttech%2Fpclstorage.desktop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flosttech%2Fpclstorage.desktop/lists"}