Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/platisd/netstrings

A simple library to decode and encode Netstrings
https://github.com/platisd/netstrings

Last synced: about 1 month ago
JSON representation

A simple library to decode and encode Netstrings

Awesome Lists containing this project

README

        

# Netstrings
A simple Arduino library to decode and encode Netstrings by Dimitris Platis.
C++ version included in /cpp by David Jensen.

## Introduction
This library allows easy decoding and encoding of Netstrings. For more information on Netstrings refer to http://cr.yp.to/proto/netstrings.txt

## API
### String encodedNetstring(String plainInput)
Provide an input in plain text to this function and it will return a Netstring. The string "error" will be returned, if an empty string is supplied.
* **Example**


```arduino
String netstring = encodedNetstring("send this as a netstring");
//nestring == 24:send this as a netstring,
```

### String decodedNetstring(String netstring)
Provide an input encoded as a Netstring and if the Netstring is valid, this function will return the string that was used to generate the Netstring. If the supplied Netstring is not valid, then an "error" string is returned.

* **Example**

```arduino
String plainInput = decodedNetstring("11:*@*#(SADASD,")
// plainInput == "*@*#(SADASD"
```