Class: Samson

Samson

new Samson(def)

Main object used when running the node-samson script. This object wraps the functionality of three internally defined modules module:node-samson/lib/ResourceReader, module:node-samson/lib/ResourceWriteer, and module:node-samson/lib/ResourceProcessor. This object binds to events that are emitted by instances of each of these modules, and then emits its own events defined within the module:node-samson/lib/event namespace.
Parameters:
Name Type Argument Description
def Object <optional>
Since:
  • 1.0
Source:
  • Samson.js, line 157
Fires:

Extends

  • module:events.EventEmitter

Namespaces

errorCode

Members

<static> options :boolean

Since:
  • 1.0
Source:
  • Samson.js, line 480

def :Object

Since:
  • 1.0
Source:
  • Samson.js, line 190

emit

Override EventEmitter.prototype.emit to handle the eventType being emitted by another emitter through an "EventTarget-like" approach to emitting events.
Since:
  • 1.0
Source:
  • Samson.js, line 290

error :Error

Since:
  • 1.0
Source:
  • Samson.js, line 195

options :Error

Since:
  • 1.0
Source:
  • Samson.js, line 200

packageInfo :Object

Since:
  • 1.0
Source:
  • Samson.js, line 205

<readonly> processor :ResourceProcessor

Since:
  • 1.0
Source:
  • Samson.js, line 148

<readonly> reader :ResourceReader

Since:
  • 1.0
Source:
  • Samson.js, line 136

reading :boolean

Since:
  • 1.0
Source:
  • Samson.js, line 210

writeManifest :Function

Since:
  • 1.0
Source:
  • Samson.js, line 220

<readonly> writer :ResourceWriter

Since:
  • 1.0
Source:
  • Samson.js, line 142

writing :boolean

Since:
  • 1.0
Source:
  • Samson.js, line 215

Methods

createLogger(writeStream) → {Function}

Parameters:
Name Type Description
writeStream fs.WriteStream
Since:
  • 1.0
Source:
  • Samson.js, line 228
Returns:
Type
Function

getReadStreamFromWritePath(file) → {module:fs.ReadStream}

Since the purpose of this object is the process or copy files from one location to another, this is a helper method that allows retrieval of the stream reading the original file based on the new file's destination.
Parameters:
Name Type Description
file string
Since:
  • 1.0
Source:
  • Samson.js, line 336
Returns:
ReadStream instance
Type
module:fs.ReadStream

getWriteStreamFromReadPath(file) → {module:fs.WriteStream}

Since the purpose of this object is the process or copy files from one location to another, this is a helper method that allows retrieval of the stream writing the new file based on the original file's location.
Parameters:
Name Type Description
file string
Since:
  • 1.0
Source:
  • Samson.js, line 352
Returns:
WriteStream instance
Type
module:fs.WriteStream

reset() → {Samson}

Since:
  • 1.0
Source:
  • Samson.js, line 364
Throws:
Error
Returns:
this
Type
Samson

run(patterns, options) → {Samson}

This method is the main entry point of the process of reading, processing, and writing files.
Parameters:
Name Type Argument Description
patterns Array
options Object <optional>
Since:
  • 1.0
Source:
  • Samson.js, line 393
Throws:
Error
Returns:
this
Type
Samson