{"id":21846626,"url":"https://github.com/binarybirds/liquid-local-driver","last_synced_at":"2025-07-20T20:30:47.096Z","repository":{"id":45427722,"uuid":"259553190","full_name":"BinaryBirds/liquid-local-driver","owner":"BinaryBirds","description":"A local driver implementation for the LiquidKit file storage solution.","archived":true,"fork":false,"pushed_at":"2023-04-11T07:59:03.000Z","size":54,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-18T21:04:22.244Z","etag":null,"topics":["file-storage","liquid-kit","swift-nio"],"latest_commit_sha":null,"homepage":"https://feathercms.com/","language":"Swift","has_issues":false,"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/BinaryBirds.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}},"created_at":"2020-04-28T06:38:25.000Z","updated_at":"2023-11-19T19:06:36.000Z","dependencies_parsed_at":"2023-02-10T06:15:30.596Z","dependency_job_id":null,"html_url":"https://github.com/BinaryBirds/liquid-local-driver","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/BinaryBirds/liquid-local-driver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinaryBirds%2Fliquid-local-driver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinaryBirds%2Fliquid-local-driver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinaryBirds%2Fliquid-local-driver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinaryBirds%2Fliquid-local-driver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BinaryBirds","download_url":"https://codeload.github.com/BinaryBirds/liquid-local-driver/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BinaryBirds%2Fliquid-local-driver/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266193058,"owners_count":23890718,"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":["file-storage","liquid-kit","swift-nio"],"created_at":"2024-11-27T23:14:45.570Z","updated_at":"2025-07-20T20:30:46.848Z","avatar_url":"https://github.com/BinaryBirds.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LiquidLocalDriver\n\nA local driver implementation for the [LiquidKit](https://github.com/BinaryBirds/liquid-kit) file storage solution.\n\nThe local driver uses a local directory on the server and the FileManager object from the Foundation framework to store files. If you are planning to setup a distributed system with multiple application servers, please consider using the [AWS S3](https://github.com/BinaryBirds/liquid-aws-s3-driver) driver instead. \n\nLiquidKit and the local driver is also compatible with Vapor 4 through the [Liquid](https://github.com/BinaryBirds/liquid) repository, that contains Vapor specific extensions.\n\n\n## Key resolution for local objects\n\nKeys are being resolved using a public base URL component, the name of the working directory and the key itself.\n\n- url = [public base URL] + [working directory name] + [key]\n\ne.g. \n\n- publicUrl = \"http://localhost/\"\n- workDirectory = \"assets\"\n- key = \"test.txt\"\n\n- resolvedUrl = \"http://localhost/assets/test.txt\"\n\n\n## Usage with SwiftNIO\n\nAdd the required dependencies using SPM:\n\n```swift\n// swift-tools-version:5.3\nimport PackageDescription\n\nlet package = Package(\n    name: \"myProject\",\n    platforms: [\n       .macOS(.v10_15)\n    ],\n    dependencies: [\n        .package(url: \"https://github.com/binarybirds/liquid\", from: \"1.3.0\"),\n        .package(url: \"https://github.com/binarybirds/liquid-local-driver\", from: \"1.3.0\"),\n    ],\n    targets: [\n        .target(name: \"App\", dependencies: [\n            .product(name: \"Liquid\", package: \"liquid\"),\n            .product(name: \"LiquidLocalDriver\", package: \"liquid-local-driver\"),\n        ]),\n    ]\n)\n```\n\nA basic usage example with SwiftNIO:\n\n```swift\n/// setup thread pool\nlet elg = MultiThreadedEventLoopGroup(numberOfThreads: 1)\nlet pool = NIOThreadPool(numberOfThreads: 1)\npool.start()\n\n/// create fs  \nlet fileio = NonBlockingFileIO(threadPool: pool)\nlet storages = FileStorages(fileio: fileio)\nstorages.use(.local(publicUrl: \"http://localhost/\",\n                    publicPath: \"/var/www/localhost/public\",\n                    workDirectory: \"assets\"), as: .local)\nlet fs = storages.fileStorage(.local, logger: .init(label: \"[test-logger]\"), on: elg.next())!\n\n/// test file upload\nlet key = \"test.txt\"\nlet data = Data(\"file storage test\".utf8)\nlet res = try await fs.upload(key: key, data: data)\n\n/// http://localhost/assets/test.txt\nlet url = req.fs.resolve(key: key)\n\n/// delete key\ntry await req.fs.delete(key: key)\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinarybirds%2Fliquid-local-driver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinarybirds%2Fliquid-local-driver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinarybirds%2Fliquid-local-driver/lists"}