## Classes
objectExtends the require capabilities to allow loading of spider script files as JS files.
String
* [#loadSpiderScript(spiderFile, [spiderModule])](#SpiderLoader+loadSpiderScript) ⇒ Object
### new SpiderLoader()
The SpiderLoader enables to load spider script files and to load them into the
node runtime as JS files.
### SpiderLoader#runSpiderScript2JS(spiderFile) ⇒ String
Converts the provided spider file into JS script text
**Returns**: String - The JS string of the converted spider script
**Access**: public
| Param | Type | Description |
| --- | --- | --- |
| spiderFile | String | The spider script file path |
### SpiderLoader#loadSpiderScript(spiderFile, [spiderModule]) ⇒ Object
Converts the provided spider file into JS script and loads it into
the node runtime.
**Returns**: Object - The JS module
**Access**: public
| Param | Type | Description |
| --- | --- | --- |
| spiderFile | String | The spider script file path |
| [spiderModule] | Object | The module for the spider script |
## NodeSpiderScript : object
Extends the require capabilities to allow loading of spider
script files as JS files.
**Kind**: global namespace
**Author**: Sagie Gur-Ari
**Example**
In order to use spider scripts under node, you need to first require this library as follows:
```js
require('node-spider-script');
```
Now you can require your spider files like any other javascript files, for example:
```js
var jsModule = require('./my-test.spider');
var person = jsModule.create('my name');
var output = person.listen('my noise');
```
In your spider file, instead of doing module.exports, do return to the object you wish to export.
For example:
```js
return {
create: fn(name) {
return new Person(name);
}
};
```
Spider source:
```js
fn Person(name) {
this.name = name;
this.listen = fn (text) {
return this.name + ' ' + text;
};
}
return {
create: fn(name) {
return new Person(name);
}
};
```
* [NodeSpiderScript](#NodeSpiderScript) : object
* [.spiderLoader](#NodeSpiderScript.spiderLoader) : [SpiderLoader](#SpiderLoader)
* [.requireSpider(spiderModule, fileName)](#NodeSpiderScript.requireSpider)
### NodeSpiderScript.spiderLoader : [SpiderLoader](#SpiderLoader)
The spider loader instance.
**Access**: public
### NodeSpiderScript.requireSpider(spiderModule, fileName)
The node require implementation for spider scripts.
**Access**: public
| Param | Type | Description |
| --- | --- | --- |
| spiderModule | Object | The module for the spider script |
| fileName | String | The spider script file name |