Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=bf53b1c54cc7d542f4f584dd2077e2187b8acbd61088e3c80799fdc0e36021de
Description
Part of the Jane Street's PPX rewriters collection.
Added to opam-repository:
README
"Ppx_embed_file"
ppx_embed_file is a simple PPX that allows embedding files directly into executables as strings or bytes so that we can embed files into OCaml programs.
How to use
First, in your dune file, specify preprocess to include ppx_embed_file and preprocessor_deps to include any files to be included:
$ cat test/dune
(library (
(name ppx_embed_test)
(libraries (core))
(preprocessor_deps (hello_world.tar.gz hello_world.txt))
(preprocess (pps (ppx_jane ppx_embed_file)))))Then, write the appropriate extension nodes in your .ml files:
open! Core
let hello_world_string = [%embed_file_as_string "hello_world.txt"]
let hello_world_string_with_filename =
[%embed_file_as_string_with_filename "hello_world.txt"]
;;
let hello_world_archived =
[%embed_file_in_tar_archive_as_string "hello_world.tar.gz:./dir/hello_world.txt"]
;;
let%expect_test "string test" =
Core.print_string hello_world_string;
[%expect {xxx| Hello world! |xxx}]
;;
let%expect_test "string with filename test" =
[%sexp_of: string * string] hello_world_string_with_filename |> Core.print_s;
[%expect {xxx| (hello_world.txt "Hello world!\n") |xxx}]
;;
let%expect_test "tar test" =
Core.print_string hello_world_archived;
[%expect {xxx| Hello world! |xxx}]
;;
Dependencies (6)
Dev Dependencies
None
Optional Dependencies
None
Used by
None
Conflicts
None
Build status
Results of building ppx_embed_file with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| v0.17.0 (this version) | n/a | n/a | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure