{"id":13413722,"url":"https://github.com/maddyblue/esc","last_synced_at":"2025-03-14T19:33:14.139Z","repository":{"id":13554921,"uuid":"16247062","full_name":"maddyblue/esc","owner":"maddyblue","description":"A simple file embedder for Go","archived":true,"fork":false,"pushed_at":"2023-10-19T05:01:50.000Z","size":1486,"stargazers_count":639,"open_issues_count":10,"forks_count":76,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-05-19T17:30:59.025Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://godoc.org/github.com/mjibson/esc","language":"Go","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/maddyblue.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}},"created_at":"2014-01-26T05:08:04.000Z","updated_at":"2024-04-02T09:20:12.000Z","dependencies_parsed_at":"2022-08-30T07:32:01.645Z","dependency_job_id":"9ecf016c-42a3-46bf-b259-975c7096e491","html_url":"https://github.com/maddyblue/esc","commit_stats":{"total_commits":63,"total_committers":17,"mean_commits":"3.7058823529411766","dds":"0.33333333333333337","last_synced_commit":"0ea7db170df78dcddf3e223365f444163147fe89"},"previous_names":["maddyblue/esc","mjibson/esc"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maddyblue%2Fesc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maddyblue%2Fesc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maddyblue%2Fesc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maddyblue%2Fesc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maddyblue","download_url":"https://codeload.github.com/maddyblue/esc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221498771,"owners_count":16833059,"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":"2024-07-30T20:01:47.422Z","updated_at":"2024-10-26T05:31:17.929Z","avatar_url":"https://github.com/maddyblue.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"## DEPRECATED\n\nStop using this and switch to [embed](https://pkg.go.dev/embed) now in the standard library.\n\n# esc\n\n[![GoDoc](https://godoc.org/github.com/mjibson/esc?status.svg)](https://godoc.org/github.com/mjibson/esc)\n\nesc embeds files into go programs and provides http.FileSystem interfaces\nto them.\n\nIt adds all named files or files recursively under named directories at the\npath specified. The output file provides an http.FileSystem interface with\nzero dependencies on packages outside the standard library.\n\n## Installation\n\n`go get -u github.com/mjibson/esc`\n\n## Usage\n\n`esc [flag] [name ...]`\n\nThe flags are:\n\n```\n-o=\"\"\n\toutput filename, defaults to stdout\n-pkg=\"main\"\n\tpackage name of output file, defaults to main\n-prefix=\"\"\n\tstrip given prefix from filenames\n-ignore=\"\"\n\tregular expression for files to ignore\n-include=\"\"\n\tregular expression for files to include\n-modtime=\"\"\n\tUnix timestamp to override as modification time for all files\n-private\n\tunexport functions by prefixing them with esc, e.g. FS -\u003e escFS\n-no-compress\n\tdo not compress files\n```\n\n## Accessing Embedded Files\n\nAfter producing an output file, the assets may be accessed with the FS()\nfunction, which takes a flag to use local assets instead (for local\ndevelopment).\n\n * (_esc)?FS(Must)?(Byte|String) returns an asset as a (byte slice|string).\n * (_esc)?FSMust(Byte|String) panics if the asset is not found.\n\n## Go Generate\n\nesc can be invoked by go generate:\n\n`//go:generate esc -o static.go -pkg server static`\n\n## Example\n\nEmbedded assets can be served with HTTP using the http.FileServer.\nAssuming you have a directory structure similar to the following:\n\n```\n.\n├── main.go\n└── static\n    ├── css\n    │   └── style.css\n    └── index.html\n```\n\nWhere main.go contains:\n\n```\npackage main\n\nimport (\n\t\"log\"\n\t\"net/http\"\n)\n\nfunc main() {\n\t// FS() is created by esc and returns a http.Filesystem.\n\thttp.Handle(\"/static/\", http.FileServer(FS(false)))\n\tlog.Fatal(http.ListenAndServe(\":8080\", nil))\n}\n\n```\n\n1. Generate the embedded data:\n\t`esc -o static.go static`\n2. Start the server:\n\t`go run main.go static.go`\n3. Access http://localhost:8080/static/index.html to view the files.\n\nYou can see worked example in [example](example) dir\njust run it as\n`go run example/main.go example/static.go`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaddyblue%2Fesc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaddyblue%2Fesc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaddyblue%2Fesc/lists"}