{"id":23564214,"url":"https://github.com/selectel/alberto","last_synced_at":"2025-04-30T16:17:52.043Z","repository":{"id":6904839,"uuid":"8154993","full_name":"selectel/alberto","owner":"selectel","description":"A simple OCaml library for writing Erlang port drivers","archived":false,"fork":false,"pushed_at":"2020-04-12T13:01:01.000Z","size":112,"stargazers_count":43,"open_issues_count":3,"forks_count":5,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-04-30T16:17:45.572Z","etag":null,"topics":["community"],"latest_commit_sha":null,"homepage":"","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/selectel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-02-12T08:06:43.000Z","updated_at":"2024-07-07T16:22:30.000Z","dependencies_parsed_at":"2022-09-22T10:10:54.734Z","dependency_job_id":null,"html_url":"https://github.com/selectel/alberto","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selectel%2Falberto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selectel%2Falberto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selectel%2Falberto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selectel%2Falberto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/selectel","download_url":"https://codeload.github.com/selectel/alberto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251739677,"owners_count":21635893,"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":["community"],"created_at":"2024-12-26T17:13:21.202Z","updated_at":"2025-04-30T16:17:52.001Z","avatar_url":"https://github.com/selectel.png","language":"OCaml","funding_links":[],"categories":[],"sub_categories":[],"readme":"```\n         __\n        /  \\\n       / ..|\\\n      (_\\  |_)\n      /  \\@'    Alberto!\n     /     \\         0.5\n_  _/  `   |\n\\\\/  \\  | _\\\n \\   /_ || \\\\_\n  \\____)|_) \\_)\n```\n\nAlberto is an implementation of\n[Erlang External Term Format](http://erlang.org/doc/apps/erts/erl_ext_dist.html),\na protocol, used by Erlang nodes to communicate with so called *ports*. See\nErlang [documentation](http://www.erlang.org/doc/tutorial/c_port.html) for\ndetails.\n\nInstallation\n------------\n\nThe simplest way to get `alberto` is to use [`OPAM`](http://opam.ocamlpro.com):\n\n```bash\nopam install alberto\n```\n\nExample\n-------\n\nOn Erlang part we have a simple echo server, which sends `\u003c\u003c\"Hello world!\"\u003e\u003e`\nto the port and echoes whatever comes back to stdout:\n\n```erlang\n#!/usr/bin/env escript\n%%! -noshell -noinput\n-mode(compile).\n-define(ME, filename:basename(escript:script_name())).\n-define(PRINT(STR, PARAMS), io:format(\"~s: \" ++ STR ++ \"~n\", [?ME | PARAMS])).\n\n\nmain([Bin]) -\u003e\n    Port = open_port({spawn, Bin},\n                     [binary, {packet, 4}]),\n    port_command(Port, term_to_binary(\"Hello world!\")),\n    receive\n        {_, {data, Data}} -\u003e\n            ?PRINT(\"~p\", [binary_to_term(Data)]),\n            main([Bin])\n    end;\nmain(_) -\u003e\n    io:format(\"~s\", [\"usage: echo.erl path/to/port\"]).\n```\n\nOCaml part is even more consice:\n\n```ocaml\nAlberto.interact (fun x -\u003e x)\n```\n\nOkay, let's see it in action (sources are available in `examples/` directory):\n\n```bash\n$ dune build examples/port_simple.exe\n$ examples/echo.erl ./_build/default/examples/port_simple.exe\necho.erl: \"Hello world!\"\necho.erl: \"Hello world!\"\necho.erl: \"Hello world!\"\necho.erl: \"Hello world!\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselectel%2Falberto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fselectel%2Falberto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselectel%2Falberto/lists"}