npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@rokt33r/season

v5.3.1

Published

CSON utilities

Downloads

14

Readme

season - CSON Node module Build 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.