Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Libraries

    tnetstring 0.2.1

    Download button

    No screenshots available
    Downloads: 160  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Ryan Kelly | More programs
    MIT/X Consortium Lic... / FREE
    June 6th, 2012, 12:17 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    tnetstring description

    Data serialization using typed netstrings

    tnetstring is a data serialization library. It's a lot like JSON but it uses a new syntax called "typed netstrings" that Zed has proposed for use in the Mongrel2 webserver. It's designed to be simpler and easier to implement than JSON, with a happy consequence of also being faster in many cases.

    An ordinary netstring is a blob of data prefixed with its length and postfixed with a sanity-checking comma. The string "hello world" encodes like this:

    11:hello world,

    Typed netstrings add other datatypes by replacing the comma with a type tag. Here's the integer 12345 encoded as a tnetstring:

    5:12345#

    And here's the list [12345,True,0] which mixes integers and bools:

    19:5:12345#4:true!1:0#]

    Simple enough? This module gives you the following functions:

     dump: dump an object as a tnetstring to a file
     dumps: dump an object as a tnetstring to a string
     load: load a tnetstring-encoded object from a file
     loads: load a tnetstring-encoded object from a string
     pop: pop a tnetstring-encoded object from the front of a string

    Note that since parsing a tnetstring requires reading all the data into memory at once, there's no efficiency gain from using the file-based versions of these functions. They're only here so you can use load() to read precisely one item from a file or socket without consuming any extra data.


    Product's homepage

    Requirements:

    · Python

      


    TAGS:

    data serialization | typed netstrings | data serialization | data | serialization | typed

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM