<commit_before># Arduino Node [![Travis CI](https://travis-ci.org/arduino-cli/arduino-node.svg?branch=master)](https://travis-ci.org/arduino-cli/arduino-node) [![Codecov](https://img.shields.io/codecov/c/github/arduino-cli/arduino-node/master.svg)](https://codecov.io/gh/arduino-cli/arduino-node) [![npm](https://img.shields.io/npm/dm/arduino-cli.svg)](https://www.npmjs.com/package/arduino-cli) [![npm version](https://img.shields.io/npm/v/arduino-cli.svg)](https://www.npmjs.com/package/arduino-cli)
> 🎁 Cross-Platform Arduino IDE in nodeJS

## Install

```
$ npm install --save arduino-node
```

## Usage

```js
const arduino = require('arduino-node');

const arduLatest = arduino({path: 'bin'});

arduLatest.run(['--verify', './your-project/your-project.ino'], (err, out) => {
  if (err) {
    console.log(err);
    return;
  }
  console.log(out.stdout);
});

const ardu180 = arduino({path: 'bin', version: '1.8.0'});

ardu180.run(['--verify', './your-project/your-project.ino'], (err, out) => {
  if (err) {
    console.log(err);
    return;
  }
  console.log(out.stdout);
});
```

## API

### .run([arguments], callback)

Runs the Arduino IDE binary. If the binary is not loaded it will also load it.

#### arguments

Type: `array`<br>
Default: `[]`
An array of arguments to pass to the Arduino IDE.

#### callback(err, out)
<commit_msg>Update readme (#8)<commit_after># Arduino Node [![Travis CI](https://travis-ci.org/arduino-cli/arduino-node.svg?branch=master)](https://travis-ci.org/arduino-cli/arduino-node) [![Codecov](https://img.shields.io/codecov/c/github/arduino-cli/arduino-node/master.svg)](https://codecov.io/gh/arduino-cli/arduino-node) [![npm](https://img.shields.io/npm/dm/arduino-cli.svg)](https://www.npmjs.com/package/arduino-cli) [![npm version](https://img.shields.io/npm/v/arduino-cli.svg)](https://www.npmjs.com/package/arduino-cli)
> 🎁 Cross-Platform Arduino IDE in nodeJS

## Install

```
$ npm install --save arduino-node
```

## Usage

```js
const arduino = require('arduino-node');

const arduLatest = arduino({path: 'bin'});

arduLatest.run(['--verify', './your-project/your-project.ino'], (err, out) => {
  if (err) {
    console.log(err);
    return;
  }
  console.log(out.stdout);
});

const ardu180 = arduino({path: 'bin', version: '1.8.0'});

ardu180.run(['--verify', './your-project/your-project.ino'], (err, out) => {
  if (err) {
    console.log(err);
    return;
  }
  console.log(out.stdout);
});
```

## API

### arduino(options)

Creates a new `arduino` instance.

#### options

Type: `object`

##### version

Type: `string`<br>
Default: `'latest'`

The Arduino IDE version to use.

##### path

Type: `string`<br>
Default: `'bin'`

The path where Arduino IDE will resides.

### .run([arguments], callback)

Runs the Arduino IDE binary. If the binary is not loaded it will also load it.

#### arguments

Type: `array`<br>
Default: `[]`

An array of arguments to pass to the Arduino IDE.

#### callback(err, out)

{'fraction_non_alphanumeric': 0.213657876943881, 'fraction_numerical': 0.006423258958755916, 'mean_word_length': 4.164048865619546, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 16, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4749549', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1130, 'n_words': 210}