{"id":26920758,"url":"https://github.com/rattleycooper/resourcetables","last_synced_at":"2025-04-01T22:48:24.103Z","repository":{"id":225268718,"uuid":"765519097","full_name":"RattleyCooper/resourcetables","owner":"RattleyCooper","description":"Super simple compile time embedded resources, and remote runtime resources. Useful for making installers.","archived":false,"fork":false,"pushed_at":"2024-04-16T00:03:27.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-17T02:16:56.247Z","etag":null,"topics":["embedded-resources","installer-tools","remote-asset"],"latest_commit_sha":null,"homepage":"","language":"Nim","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/RattleyCooper.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}},"created_at":"2024-03-01T04:30:08.000Z","updated_at":"2024-04-17T02:16:56.248Z","dependencies_parsed_at":"2024-04-15T22:32:31.613Z","dependency_job_id":"3bac8a1b-c0c2-430b-93a2-29b1ba4264dd","html_url":"https://github.com/RattleyCooper/resourcetables","commit_stats":null,"previous_names":["rattleycooper/resourcetables"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RattleyCooper%2Fresourcetables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RattleyCooper%2Fresourcetables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RattleyCooper%2Fresourcetables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RattleyCooper%2Fresourcetables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RattleyCooper","download_url":"https://codeload.github.com/RattleyCooper/resourcetables/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246724799,"owners_count":20823544,"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":["embedded-resources","installer-tools","remote-asset"],"created_at":"2025-04-01T22:48:23.573Z","updated_at":"2025-04-01T22:48:24.089Z","avatar_url":"https://github.com/RattleyCooper.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"# resourcetables\n Super simple compile time embedded resources, and remote runtime resources. Useful if you're trying to ship an application and want to create an offline or online installer.\n\n## Install\n\n`nimble install https://github.com/RattleyCooper/resourcetables`\n\n## Examples\n\n```nim\nimport resourcetables\n\n# Embed an entire directory at compile time\nconst assets = embed(\"asset-folder\")\necho assets[\"some-file.txt\"]\n\n# Compress directory\nconst compressedAssets = staticCompress(\"asset-folder\")\n\n# uncompress \u0026 extract at runtime\ncompressedAssets.uncompress()\n\n# if you have zippy imported and don't need to extract\nlet fileContents = compressedAssets[\"some-file.txt].uncompress()\n\n# Embed specific resources at compile time\n# You could also use staticCompress(\"specificRes\"): \n# if you want to compress specific files.\nembed(\"specificRes\"):\n  \"another/file.txt\"\n  # use triple quoted string to retain full path\n  \"\"\"other/stuff.png\"\"\"  \n\n# Access embedded resources\nspecificRes[\"file.txt]\nspecificRes[\"other/stuff.png]\n\n# Fetch remote resources at runtime. 3 infix operators\n# are available for saving data and/or rewriting keys.\n\nremote(\"online\"):\n  # Store resulting data using the key \"gF1bsWr.jpeg\"\n  \"https://i.imgur.com/gF1bsWr.jpeg\"\n\n  # Save resulting data to \"new.jpeg\"\n  \"https://i.imgur.com/gF1bsWr.jpeg\" -\u003e \"new.jpeg\"\n\n  # Use \"new.jpeg\" as the key in the `online` table\n  \"https://i.imgur.com/gF1bsWr.jpeg\" \u003c- \"new.jpeg\"\n\n  # Save data to \"new.jpeg\" and use \"new.jpeg\" as \n  # the key in the `online` table.\n  \"https://i.imgur.com/gF1bsWr.jpeg\" \u003c-\u003e \"new.jpeg\"   \n```\n\n# Creating an Installer\n\n```nim\n# Embed our game files into the binary at compile time\n# and extract them when the binary is executed.\n\nimport resourcetables\n\n\n# Compile-time\nembed(\"data\"):\n  \"D:/Code/Nim/playground/nicopg/SDL2.dll\"\n  \"D:/Code/Nim/playground/nicopg/conway.exe\"\n\nembed(\"assets\"):\n  \"D:/Code/Nim/playground/nicopg/assets/font.png\"\n  \"D:/Code/Nim/playground/nicopg/assets/font.png.dat\"\n  \"D:/Code/Nim/playground/nicopg/assets/icon.png\"\n\n# Runtime\ndata.extract()\nassets.extract(\"assets\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frattleycooper%2Fresourcetables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frattleycooper%2Fresourcetables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frattleycooper%2Fresourcetables/lists"}