# nachos-settings-file

> Settings file is a tool to handle nachos settings files

Latest version **1.0.3** (published 2015-08-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install nachos-settings-file
pnpm add nachos-settings-file
yarn add nachos-settings-file
bun add nachos-settings-file
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2015-08-17 |
| First published | 2015-07-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Nachos team |
| Maintainers | eladbezalel, amirschl, omrilitov, noamokman |
| Keywords | nachos, settings, json, file |

## Links

- npm: https://www.npmjs.com/package/nachos-settings-file
- Repository: https://github.com/nachos/settings-file
- Issues: https://github.com/nachos/settings-file/issues
- npm.io page: https://npm.io/package/nachos-settings-file

## Dependencies (8)

- [q](https://npm.io/package/q.md) ^1.4.1
- [debug](https://npm.io/package/debug.md) ^2.2.0
- [isuuid](https://npm.io/package/isuuid.md) ^0.1.0
- [lodash](https://npm.io/package/lodash.md) ^3.10.0
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [defaults](https://npm.io/package/defaults.md) ^1.0.2
- [jsonfile](https://npm.io/package/jsonfile.md) ^2.2.1
- [nachos-home](https://npm.io/package/nachos-home.md) ^1.0.1

## 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

- 1.0.3 (latest) — 2015-08-17
- 1.0.2 — 2015-07-29
- 1.0.1 — 2015-07-28
- 1.0.0 — 2015-07-28

## README

# settings-file

Settings file is a tool to handle nachos settings files

<table>
  <thead>
    <tr>
      <th>Linux</th>
      <th>OSX</th>
      <th>Windows</th>
      <th>Coverage</th>
      <th>Dependencies</th>
      <th>DevDependencies</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td colspan="2" align="center">
        <a href="https://travis-ci.org/nachos/settings-file"><img src="https://img.shields.io/travis/nachos/settings-file.svg?style=flat-square"></a>
      </td>
      <td align="center">
        <a href="https://ci.appveyor.com/project/nachos/settings-file"><img src="https://img.shields.io/appveyor/ci/nachos/settings-file.svg?style=flat-square"></a>
      </td>
      <td align="center">
<a href='https://coveralls.io/r/nachos/settings-file'><img src='https://img.shields.io/coveralls/nachos/settings-file.svg?style=flat-square' alt='Coverage Status' /></a>
      </td>
      <td align="center">
        <a href="https://david-dm.org/nachos/settings-file"><img src="https://img.shields.io/david/nachos/settings-file.svg?style=flat-square"></a>
      </td>
      <td align="center">
        <a href="https://david-dm.org/nachos/settings-file#info=devDependencies"><img src="https://img.shields.io/david/dev/nachos/settings-file.svg?style=flat-square"/></a>
      </td>
    </tr>
  </tbody>
</table>

## Have a problem? Come chat with us!
[![Join the chat at https://gitter.im/nachos/settings-file](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/nachos/settings-file?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

## Installation
``` bash
  $ [sudo] npm install settings-file --save
```

## Examples
### Initialize
``` js
var SettingsFile = require('settings-file');

// Wraps /path/to/user/home/.nachos/data/test.json file
var settingsFile = new SettingsFile('test'); 

// Provide default settings
var settingsFile = new SettingsFile('test', {
    globalDefaults: {color: 'blue'},
    instanceDefaults: {color: 'red'}
  }); 
```

### Global Settings
``` js
// Read global settings
settingsFile.get()
  .then(function(settings) {
    // do stuff with settings
  });
  
// Set selective fields
// file contents before: {color: 'blue', name: 'nacho'}
settingsFile.set({name: 'nyancat'})
  .then(function() {
    // saved!
    // file contents after: {color: 'blue', name: 'nyancat'}
  });
  
// Save settings (replaces existing settings)
// file contents before: {color: 'blue', name: 'nacho'}
settingsFile.save({name: 'nyancat'})
  .then(function() {
    // saved!
    // file contents after: {name: 'nyancat'}
  });
  
// Delete the file
settings.delete()
  .then(function () {
    // deleted!
  });
```

### Instance Settings
``` js
// Read instance settings
settingsFile
  .instance(uuid)
  .get()
  .then(function(settings) {
    // do stuff with settings
  });
  
// Set selective fields
// instance contents before: {color: 'red', name: 'nacho'}
settingsFile
  .instance(uuid)
  .set({name: 'nyancat'})
  .then(function() {
    // saved!
    // instance contents after: {color: 'red', name: 'nyancat'}
  });
  
// Save settings (replaces existing settings)
// instance contents before: {color: 'red', name: 'nacho'}
settingsFile
  .instance(uuid)
  .save({name: 'nyancat'})
  .then(function() {
    // saved!
    // instance contents after: {name: 'nyancat'}
  });
  
// Delete the instance  
settings
  .instance(uuid)
  .delete()
  .then(function () {
    // deleted!
  });
```

## Run Tests
``` bash
  $ npm test
```

## License

[MIT](LICENSE)

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