# season

> CSON utilities

Latest version **6.0.2** (published 2017-10-23) · 0 weekly downloads

## Install

```sh
npm install season
pnpm add season
yarn add season
bun add season
```

Provides the command `csonc`.

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.0.2 |
| Published | 2017-10-23 |
| First published | 2013-05-13 |
| Weekly downloads | 0 |
| TypeScript types | separate (@types/season) |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 83 |
| Maintainers | damieng, smashwilson, atom-team, as-cii, maxbrunsfeld, nathansobo, benogle, aroben, kevinsawicki |
| Keywords | cson, json, CoffeeScript |

## Links

- npm: https://www.npmjs.com/package/season
- Repository: https://github.com/atom/season
- Homepage: http://atom.github.io/season
- Issues: https://github.com/atom/season/issues
- npm.io page: https://npm.io/package/season

## Dependencies (3)

- [yargs](https://npm.io/package/yargs.md) ^3.23.0
- [fs-plus](https://npm.io/package/fs-plus.md) ^3.0.0
- [cson-parser](https://npm.io/package/cson-parser.md) ^1.3.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 6.0.2 (latest) — 2017-10-23
- 6.0.1 — 2017-09-11
- 6.0.0 — 2017-03-06
- 5.4.1 — 2016-09-22
- 5.4.0 — 2016-09-22
- 5.3.0 — 2015-06-10
- 5.2.0 — 2015-04-21
- 5.1.5 — 2015-03-27
- 5.1.4 — 2015-02-12
- 5.1.3 — 2015-02-04
- 5.1.2 — 2015-01-29
- 5.1.1 — 2015-01-23
- 5.1.0 — 2015-01-23
- 5.0.5 — 2015-01-13
- 5.0.4 — 2015-01-13
- … 26 more at https://npm.io/package/season/versions

## README

# season - CSON Node module
[![macOS Build Status](https://travis-ci.org/atom/season.svg?branch=master)](https://travis-ci.org/atom/season) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/v3bth3ooq5q8k8lx/branch/master?svg=true)](https://ci.appveyor.com/project/Atom/season) [![Dependency Status](https://david-dm.org/atom/season.svg)](https://david-dm.org/atom/season)

Read and write CSON/JSON files seamlessly.

## Installing

```sh
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:

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

## Docs

```coffeescript
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.

---
_Source: https://npm.io/package/season · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
