season
CSON utilities
Last updated 7 years ago by damieng .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install season 
SYNC missed versions from official npm registry.

season - CSON Node module

macOS Build Status Windows Build Status Dependency Status

Read and write CSON/JSON files seamlessly.

Installing

npm install season

Building

  • Clone the repository
  • Run npm install
  • Run grunt to compile the CoffeeScript code
  • Run grunt test to run the specs

Compiling CSON to JSON

This module comes with a csonc executable that allows you to compile a CSON file to JSON.

To use:

npm install -g season
echo "this: 'is cson'" > file.cson
csonc file.cson --output file.json
cat file.json
{
  "this": "is cson"
}

Docs

CSON = require 'season'

CSON.setCacheDir(cacheDirectory)

Set the cache directory to use for storing compiled CSON files.

cacheDirectory - Root directory path for storing compiled CSON.

CSON.stringify(object)

Convert the object to a CSON string.

object - The object to convert to CSON.

Returns the CSON string representation of the given object.

CSON.readFile(objectPath, callback)

Read the CSON or JSON object at the given path and return it to the callback once it is read and parsed.

objectPath - The string path to a JSON or CSON object file.

callback - The function to call with the error or object once the path is read and parsed.

CSON.readFileSync(objectPath)

Synchronous version of CSON.readFile(objectPath, callback).

Returns the object read from the path or throws an error if reading fails.

CSON.writeFile(objectPath, object, callback)

Write the object to the given path as either JSON or CSON depending on the path's extension.

objectPath - The string path to a JSON or CSON object file.

object - The object to convert to a string and write to the path.

callback - The function to with an error object on failures.

CSON.writeFileSync(objectPath, object)

Synchronous version of CSON.writeFile(objectPath, object, callback)

CSON.isObjectPath(objectPath)

Is the given path a valid object path?

Returns true if the path has a .json or .cson file extension, false otherwise.

CSON.resolve(objectPath)

Resolve the path to an existent file that has a .json or .cson extension.

objectPath - The string path to a JSON or CSON object file with or without an extension.

Returns the path to an existent CSON or JSON file or null if none found.

Current Tags

  • 6.0.2                                ...           latest (7 years ago)

41 Versions

  • 6.0.2                                ...           7 years ago
  • 6.0.1                                ...           7 years ago
  • 6.0.0                                ...           8 years ago
  • 5.4.1                                ...           8 years ago
  • 5.4.0                                ...           8 years ago
  • 5.3.0                                ...           9 years ago
  • 5.2.0                                ...           10 years ago
  • 5.1.5                                ...           10 years ago
  • 5.1.4                                ...           10 years ago
  • 5.1.3                                ...           10 years ago
  • 5.1.2                                ...           10 years ago
  • 5.1.1                                ...           10 years ago
  • 5.1.0                                ...           10 years ago
  • 5.0.5                                ...           10 years ago
  • 5.0.4                                ...           10 years ago
  • 5.0.3                                ...           10 years ago
  • 5.0.2                                ...           10 years ago
  • 5.0.1                                ...           10 years ago
  • 5.0.0                                ...           10 years ago
  • 4.0.3                                ...           10 years ago
  • 4.0.2                                ...           10 years ago
  • 4.0.1                                ...           10 years ago
  • 4.0.0                                ...           10 years ago
  • 3.0.0                                ...           10 years ago
  • 2.0.0                                ...           11 years ago
  • 1.0.2                                ...           11 years ago
  • 1.0.1                                ...           11 years ago
  • 1.0.0                                ...           11 years ago
  • 0.14.0                                ...           11 years ago
  • 0.13.0                                ...           11 years ago
  • 0.12.0                                ...           11 years ago
  • 0.11.0                                ...           11 years ago
  • 0.10.0                                ...           12 years ago
  • 0.9.0                                ...           12 years ago
  • 0.7.0                                ...           12 years ago
  • 0.6.0                                ...           12 years ago
  • 0.4.0                                ...           12 years ago
  • 0.5.0                                ...           12 years ago
  • 0.3.0                                ...           12 years ago
  • 0.2.0                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (8)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |