//Imports
var path = require( "path" ),
packageJSON = require( path.join( "..", "..", "package.json" ) );
/**
*
* @access public
* @constructor
* @param {object} options
* @since 0.6.0
*/
function ftpdjs( options ) {
this.options = options;
}
/**
* @callback ftpdjs~logCallback
* @param {object} error the error if one occoured
* @since 0.6.0
*/
/**
*
* This function is used to log messages to the attached stream
*
* @access public
* @param {string} message the message to log
* @param {ftpdjs~logCallback} callback the callback to invoke when finished logging or an error occoured. Optional
* @since 0.6.0
*/
ftpdjs.prototype.log = function ( message, callback ) {
if ( typeof(this.getOptions().logger === "function") ) {
try {
this.getOptions().logger.write( message, "utf8", callback );
} catch ( error ) {
if ( typeof(callback === "function") ) {
callback( error );
}
}
}
};
/**
*
* @access public
* @returns {object} the package.json for ftpd.js
* @since 0.6.0
*/
ftpdjs.prototype.getPackage = function () {
return packageJSON;
};
/**
*
* @access public
* @returns {object} the options object for ftpd.js
* @since 0.6.0
*/
ftpdjs.prototype.getOptions = function () {
return this.options;
};
/**
*
* @access public
* @type {ftpdjs}
* @since 0.6.0
*/
module.exports = ftpdjs;