Skip to content

mwmiller/netstrings_ex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

Elixir encoder and decoder for djb's netstrings

Installation

# add dependencies in mix.exs
defp deps do
  [
    {:netstrings, "~> 2.0"}
  ]
end

# and fetch
$ mix deps.get

Examples

iex> Netstrings.encode(0)
{:error, "Can only encode binaries"}
iex> Netstrings.encode("hello world!")
"12:hello world!,"

iex> Netstrings.decode(0)
{:error, "Can only decode binaries"}
iex> Netstrings.decode("12:hello world!,")
{["hello world!"], ""}

iex> {:ok, file} = File.open("net.strings")
{:ok, #PID<0.121.0>}
iex> Netstrings.stream(file)
%Netstrings.Stream{buffer: "", device: #PID<0.121.0>}

About

netstrings implementation in Elixir

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages