• Stars
    star
    50
  • Rank 557,083 (Top 12 %)
  • Language
    Erlang
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Fast YAML native library for Erlang / Elixir

Fast YAML

CI Coverage Status Hex version

Fast YAML is an Erlang wrapper for libyaml "C" library.

It is designed to be fast and efficient.

Installation

Dependencies

Fast YAML depends on native LibYaml library. You need development headers for LibYaml library to build it.

The minimum required Erlang/OTP version is 18.0

Generic build

You can trigger build with:

./configure && make

OSX build example

You can install LibYaml and with Homebrew:

brew install libyaml

You can then export environment variable to use LibYaml as installed by Homebrew, before issuing compilation commands:

export LDFLAGS="-L/usr/local/lib"
export CFLAGS="-I/usr/local/include"
export CPPFLAGS="-I/usr/local/include"

./configure && make

Example usage

erl -pa ebin -pa deps/*/ebin
Erlang/OTP 18 [erts-7.1] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Eshell V7.1  (abort with ^G)

1> application:start(fast_yaml).
ok

2> fast_yaml:decode(<<"a: 1\nb: -3.0">>).
{ok,[[{<<"a">>,1},{<<"b">>,-3.0}]]}

Option plain_as_atom

Converts all unquoted YAML values to atoms

3> fast_yaml:decode(<<"a: 1\nb: -3.0">>, [{plain_as_atom, true}]).
{ok,[[{a,1},{b,-3.0}]]}

4> fast_yaml:decode(<<"a: b\nc">>).
{error,{scanner_error,<<"could not find expected ':'">>,2,
                      0}}.

5> fast_yaml:decode_from_file("test/test2.yml", [plain_as_atom]).
{ok,[[[{step,[{instrument,<<"Lasik 2000">>},
              {pulseEnergy,5.4},
              {pulseDuration,12},
              {repetition,1000},
              {spotSize,<<"1mm">>}]}],
      [{step,[{instrument,<<"Lasik 2000">>},
              {pulseEnergy,5.0},
              {pulseDuration,10},
              {repetition,500},
              {spotSize,<<"2mm">>}]}],
      [{step,<<"id001">>}],
      [{step,<<"id002">>}],
      [{step,<<"id001">>}],
      [{step,<<"id002">>}]]]}

Option sane_scalars

Converts the following scalar values to their Erlang-native data type:

"null" β†’ undefined "true" β†’ true "false" β†’ false

Integer and float values also get converted. All other scalar values stay binaries. Key in mappings also stay binary and never get coerced into int / float / atom .

An unquoted mapping value that is an empty string gets converted into undefined. (e.g. the string "foo:" decodes as [{<<"foo">>, undefined}])

Option maps

Convert YAML mappings into Erlang maps.

7> fast_yaml:decode(<<"a: true\nb: -3.0\nc: string">>, [{maps, true}]).
{ok, [#{"a" => "true", "b" => -3.0, "c" => "string"}]}

For compatibility with the yamerl and YamlElixir libraries, use the [sane_scalars, maps] options.

Development

Test

Unit test

You can run eunit test with the command:

make test

More Repositories

1

ejabberd

Robust, Ubiquitous and Massively Scalable Messaging Platform (XMPP, MQTT, SIP Server)
Erlang
5,849
star
2

tsung

Tsung is a high-performance benchmark framework for various protocols including HTTP, XMPP, LDAP, etc.
Erlang
2,499
star
3

ejabberd-contrib

Growing and curated ejabberd contributions repository - PR or ask to join !
Erlang
244
star
4

stun

STUN and TURN library for Erlang / Elixir
Erlang
239
star
5

xmpp-messenger-ios

iOS XMPP Messenger Framework
Swift
219
star
6

eturnal

STUN / TURN standalone server
Erlang
197
star
7

exmpp

Erlang XMPP library
Erlang
182
star
8

fast_xml

Fast Expat based Erlang XML parsing library
Erlang
127
star
9

xmpp

Erlang/Elixir XMPP parsing and serialization library on top of Fast XML
Erlang
122
star
10

oneteam

OneTeam XMPP multi-platform client. This is a Mozilla / XUL based platform, developed mostly in Javascript and C++ XPCOM.
C
101
star
11

grapherl

ejabberd monitoring server
Erlang
90
star
12

docker-ejabberd

Set of ejabberd Docker images
Shell
89
star
13

fast_tls

TLS / SSL OpenSSL-based native driver for Erlang / Elixir
C
81
star
14

demo-xmpp-ios

XMPPFramework Basic client relying using CocoaPods package
Swift
56
star
15

iconv

Fast encoding conversion library for Erlang / Elixir
Shell
51
star
16

rtb

Benchmarking tool to stress real-time protocols
Erlang
48
star
17

eimp

Erlang Image Manipulation Process
Erlang
46
star
18

cache_tab

In-memory cache Erlang / Elixir library
Erlang
44
star
19

oms

Erlang-based Flash media server supporting video streaming, video conferencing, RPC call from client and from server, Remote Shared objects.
JavaScript
43
star
20

ejabberd-vagrant-dev

Vagrant and Ansible script to create a VM preconfigured for ejabberd development
31
star
21

go-erlang

Go library for Erlang/Elixir interop
Go
30
star
22

ejabberd-api

ejabberd API library in Go and multi-platform command-line tool
Go
23
star
23

xmpp-websocket-client

Test XMPP Websocket client
JavaScript
21
star
24

p1_pgsql

Pure Erlang PostgreSQL driver
Erlang
19
star
25

oneweb

OneWeb firefox extension to interact with browser and share content over XMPP
JavaScript
18
star
26

p1_mysql

Pure Erlang MySQL driver
Erlang
18
star
27

p1_utils

Erlang Utility Modules from ProcessOne
Erlang
18
star
28

esip

ProcessOne SIP server component in Erlang
Erlang
18
star
29

stringprep

Fast Stringprep implementation for Erlang / Elixir
C
16
star
30

fast_ts

Fast TS is a fast Time Series Event Stream Processor
Elixir
16
star
31

jamler

OCaml
15
star
32

docs.ejabberd.im

This is documentation site for ejabberd messaging server
Makefile
14
star
33

mysql

Erlang MySQL driver
Erlang
13
star
34

xml

Fast Expat based Erlang XML parsing library
Erlang
12
star
35

mqtree

Index tree for MQTT topic filters
C
12
star
36

ezlib

Native zlib driver for Erlang / Elixir
Erlang
11
star
37

p1_acme

ACME client library for Erlang
Erlang
11
star
38

eiconv

iconv Erlang binding
Shell
10
star
39

tls

TLS / SSL native driver for Erlang / Elixir
C
10
star
40

p1pp

ProcessOne Push Platform Command Line
Ruby
10
star
41

dpk

Analyse & convert data from online services for backup, indexing or migration purpose
Go
9
star
42

epam

epam helper for Erlang / Elixir PAM authentication support
Erlang
9
star
43

pkix

PKIX certificates management for Erlang
Erlang
9
star
44

httpmock

HTTP recorder and mock library
HTML
9
star
45

pgsql

Pure Erlang PostgreSQL driver
Erlang
8
star
46

xmpp-notifier

Github Action to send repository notifications to XMPP
Go
8
star
47

p1_yaml

Fast Yaml native library for Erlang / Elixir
Erlang
7
star
48

p1pp-js

ProcessOne Push Platform Javascript library
JavaScript
7
star
49

android-wave-client

Wave client for Android mobile
Java
6
star
50

elixir_experiments

This is a repository containing Elixir experiments for ejabberd
Elixir
5
star
51

eredis_queue

Erlang Async Job Processing
Erlang
5
star
52

zlib

Native zlib driver for Erlang
Erlang
5
star
53

bfile

An interface to fast FILE I/O
C
5
star
54

ecrdt

CRDT compliant data structures
Erlang
4
star
55

yconf

YAML configuration processor
Erlang
4
star
56

p1_sip

ProcessOne SIP server component
Erlang
4
star
57

rebar3_exunit

A plugin to run Elixir ExUnit tests from rebar3 build tool
Erlang
2
star
58

google-wave-api

Wave API ported for Android
Java
2
star
59

dns-tools

Provides a programmer-friendly API for a number of undocumented OTP dns lookup, resolution, caching and configuration functions.
Erlang
2
star
60

ejabberd-po

Translation files for ejabberd
Erlang
2
star
61

soundcloud

Minimal library to implement SoundCloud client in Go
Go
1
star
62

OpenfireExporter

Export users from Openfire
1
star
63

p1_logger

ProcessOne logger for ejabberd
Erlang
1
star
64

jorge

Jorge is set of php scripts that are front-end for Oleg Palij ejabberd mod_logdb
PHP
1
star
65

ejabberdOSXPrefs

ejabberd preference panel for OSX
Objective-C
1
star
66

boxcar-ios-framework

iOS Push Framework for Boxcar
Objective-C
1
star
67

jira-security-level-plugin

This is a JIRA plugin to automatically set security level based on group of the reporter
Java
1
star