package ppx_blob

  1. Overview
  2. Docs
Include a file as a string at compile time

Install

Dune Dependency

Authors

Maintainers

Sources

ppx_blob-0.9.0.tbz
sha256=f115e90a5f1075cedc9d930ab91271f8670ece4dee10dc1147ab39b8afb570e4
sha512=bad11f8ffbec82a04bb5f90e7548a7ad9ac4bf7e9b733815f6c956d7e0002fb258c52783ded847ab09fe3cd60e5eac2901fccaefd4fd4f885f20942d0ef66fea

README.md.html

ppx_blob

This is an OCaml PPX to include a binary blob from a file as a string. Writing [%blob "filename"] will replace the string with the contents of the file at compile time. This allows the inclusion of arbitrary, possibly compressed, data, without the need to respect OCaml's lexical conventions.

The filename can be relative to either the source file where [%blob] appears, or relative to the current working directory. If both files exist, the former takes precedence.

Integration with build systems

Dune

Add (preprocessor_deps (file path/to/file)) to your library or executable stanza. See test/dune for an example. This will make sure the file is copied to the build directory and therefore visible to ppx_blob.

Development

Requirements:

Run make and make test.

OCaml

Innovation. Community. Security.