• Stars
    star
    51
  • Rank 568,706 (Top 12 %)
  • Language
    Erlang
  • License
    Apache License 2.0
  • Created about 9 years ago
  • Updated 6 months 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
6,101
star
2

tsung

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

ejabberd-contrib

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

stun

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

eturnal

STUN / TURN standalone server
Erlang
241
star
6

xmpp-messenger-ios

iOS XMPP Messenger Framework
Swift
219
star
7

exmpp

Erlang XMPP library
Erlang
179
star
8

xmpp

Erlang/Elixir XMPP parsing and serialization library on top of Fast XML
Erlang
136
star
9

fast_xml

Fast Expat based Erlang XML parsing library
Erlang
134
star
10

oneteam

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

docker-ejabberd

Set of ejabberd Docker images
Shell
95
star
12

grapherl

ejabberd monitoring server
Erlang
91
star
13

fast_tls

TLS / SSL OpenSSL-based native driver for Erlang / Elixir
C
83
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
54
star
16

rtb

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

eimp

Erlang Image Manipulation Process
Erlang
47
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

go-erlang

Go library for Erlang/Elixir interop
Go
31
star
21

ejabberd-vagrant-dev

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

ejabberd-api

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

xmpp-websocket-client

Test XMPP Websocket client
JavaScript
21
star
24

esip

ProcessOne SIP server component in Erlang
Erlang
20
star
25

p1_utils

Erlang Utility Modules from ProcessOne
Erlang
19
star
26

p1_pgsql

Pure Erlang PostgreSQL driver
Erlang
19
star
27

oneweb

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

p1_mysql

Pure Erlang MySQL driver
Erlang
18
star
29

fast_ts

Fast TS is a fast Time Series Event Stream Processor
Elixir
17
star
30

stringprep

Fast Stringprep implementation for Erlang / Elixir
C
16
star
31

jamler

OCaml
15
star
32

docs.ejabberd.im

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

mqtree

Index tree for MQTT topic filters
C
14
star
34

ezlib

Native zlib driver for Erlang / Elixir
Erlang
13
star
35

mysql

Erlang MySQL driver
Erlang
13
star
36

xml

Fast Expat based Erlang XML parsing library
Erlang
12
star
37

pkix

PKIX certificates management for Erlang
Erlang
11
star
38

epam

epam helper for Erlang / Elixir PAM authentication support
Erlang
11
star
39

p1_acme

ACME client library for Erlang
Erlang
11
star
40

eiconv

iconv Erlang binding
Shell
10
star
41

tls

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

p1pp

ProcessOne Push Platform Command Line
Ruby
10
star
43

dpk

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

httpmock

HTTP recorder and mock library
HTML
9
star
45

xmpp-notifier

Github Action to send repository notifications to XMPP
Go
9
star
46

pgsql

Pure Erlang PostgreSQL driver
Erlang
8
star
47

p1_yaml

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

yconf

YAML configuration processor
Erlang
7
star
49

p1pp-js

ProcessOne Push Platform Javascript library
JavaScript
7
star
50

fluux

fluux.io is a scalable messaging service (SaaS) powered by ejabberd Business Edition
7
star
51

android-wave-client

Wave client for Android mobile
Java
6
star
52

elixir_experiments

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

eredis_queue

Erlang Async Job Processing
Erlang
5
star
54

zlib

Native zlib driver for Erlang
Erlang
5
star
55

ecrdt

CRDT compliant data structures
Erlang
4
star
56

bfile

An interface to fast FILE I/O
C
4
star
57

p1_sip

ProcessOne SIP server component
Erlang
4
star
58

rebar3_exunit

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

google-wave-api

Wave API ported for Android
Java
2
star
60

dns-tools

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

ejabberd-po

Translation files for ejabberd
Erlang
2
star
62

soundcloud

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

OpenfireExporter

Export users from Openfire
1
star
64

p1_logger

ProcessOne logger for ejabberd
Erlang
1
star
65

jorge

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

ejabberdOSXPrefs

ejabberd preference panel for OSX
Objective-C
1
star
67

boxcar-ios-framework

iOS Push Framework for Boxcar
Objective-C
1
star
68

jira-security-level-plugin

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