Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including toml-paser with all npm packages installed. Try it out:

var tomlPaser = require("toml-paser")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

toml-paser v0.0.11

A TOML parser for node.js


    apbmba:toml aaronblohowiak$ node
    > toml = require('toml-parser')
    [Function: parse]
    > str = require('fs').readFileSync('./toml/example.toml', 'utf-8')
    '# This is a TOML document. Boom.\n\ntitle = "TOML Example"\n\n[owner]\nname = "Tom Preston-Werner"\norganization = "GitHub"\nbio = "GitHub Cofounder & CEO\\nLikes tater tots and beer."\ndob = 1979-05-27T07:32:00Z # First class dates? Why not?\n\n[database]\nserver = ""\nports = [ "8001", "8001", "8002" ]\nconnection_max = 5000\n\n[servers]\n\n  # You can indent as you please. Tabs or spaces. TOML don\'t care.\n  [servers.alpha]\n  ip = ""\n  dc = "eqdc10"\n\n  [servers.beta]\n  ip = ""\n  dc = "eqdc10"\n\n\n\n'
    > toml(str)
    { title: 'TOML Example',
       { name: 'Tom Preston-Werner',
         organization: 'GitHub',
         bio: 'GitHub Cofounder & CEO\nLikes tater tots and beer.',
         dob: Sun May 27 1979 00:32:00 GMT-0700 (PDT) },
       { server: '',
         ports: [ '8001', '8001', '8002' ],
         connection_max: 5000 },
       { alpha: { ip: '', dc: 'eqdc10' },
          { ip: '',
            dc: 'eqdc10',
            negative: -10,
            negativeFloat: -0.13 } } }


toml.js is fully-compliant in feature support and in error conditions

Error handling

For most errors, the string will fail during parsing and an error will be raised giving the character index of the last known good position. For some errors, such as the presence of \r and \0, the error will be raised at value generation time.


npm install toml-parser


> require('toml-parser')("hi=3")
{ hi: 3 }


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free