# file-embed

> Embed files and directories into Haskell code at compile time with Template Haskell

Source: https://talira.ai/catalog/file-embed-1vd6xk77
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [developer tools / build / asset embedding](https://talira.ai/categories/developer-tools/build/asset-embedding), [languages / haskell](https://talira.ai/categories/languages/haskell)
- Licence: BSD-2-Clause[^2][^3]
- Pricing: Free and open source[^1]
- Free tier: yes[^1]
- Backed by: [Michael Snoyman](https://talira.ai/orgs/michael-snoyman.md)

file-embed uses Template Haskell to read a file, or every file in a directory, at compile time and embed its contents in your Haskell code as a ByteString (or path and ByteString pairs), so data like JSON or text files ships inside the binary. Paths can be given relative to the package root.

## Links

- GitHub: https://github.com/snoyberg/file-embed

## Problems it solves

- ship a JSON file inside my Haskell executable instead of reading it at runtime
- bundle static assets into a single Haskell binary
- include a directory of templates in my compiled Haskell program

## Features

- embed one file's contents as a ByteString at compile time
- embed every file in a directory as (path, ByteString) pairs
- paths relative to the package root with embedFileRelative

## Limitations

- Embedding happens through Template Haskell, so the module needs the TemplateHaskell extension.[^1]

## Trust

Overall: 0.21 out of 1.
Signals: maintenance 0.06, adoption 0.40, momentum 0.05, community 0.54, backing 0.30, extensibility 0.00.

- 99 GitHub stars
- 22 contributors
- backed by Michael Snoyman

Warnings:

- last commit 21 months ago

## Sources

[^1]: https://github.com/snoyberg/file-embed#readme (checked 28 Nov 2026)
[^2]: https://github.com/snoyberg/file-embed/blob/master/LICENSE (checked 28 Nov 2026)
[^3]: https://github.com/snoyberg/file-embed/blob/master/file-embed.cabal (checked 28 Nov 2026)
