lib/extends/_filesToString.js
function _filesToString (files, encoding, separator, callback) {

			if ("undefined" === typeof files) {
				throw new ReferenceError("missing \"files\" argument");
			}
				else if ("object" !== typeof files || !(files instanceof Array)) {
					throw new TypeError("\"files\" argument is not an Array");
				}
			else if ("undefined" === typeof callback && "undefined" === typeof separator && "undefined" === typeof encoding) {
				throw new ReferenceError("missing \"callback\" argument");
			}
				else if ("function" !== typeof callback && "function" !== typeof separator && "function" !== typeof encoding) {
					throw new TypeError("\"callback\" argument is not a function");
				}
			else {

				let _callback = callback;

				if ("undefined" === typeof _callback) {

					if ("undefined" === typeof separator) {
						_callback = encoding;
					}
					else {
						_callback = separator;
					}

				}

				filesToStreamProm(files, "string" === typeof separator ? separator : " ").then((readStream) => {

					return new Promise((resolve, reject) => {

						let data = "";
						let error = false;

						readStream.once("error", (_err) => {

							error = true;
							reject(_err);

						}).on("data", (chunk) => {
							data += chunk.toString("string" === typeof encoding ? encoding : "utf8");
						}).once("end", () => {

							if (!error) {
								resolve(data);
							}

						});

					});

				}).then((data) => {
					_callback(null, data);
				}).catch(_callback);

			}

		}
function _filesToString (files, encoding, separator, callback) {

			if ("undefined" === typeof files) {
				throw new ReferenceError("missing \"files\" argument");
			}
				else if ("object" !== typeof files || !(files instanceof Array)) {
					throw new TypeError("\"files\" argument is not an Array");
				}
			else if ("undefined" === typeof callback && "undefined" === typeof separator && "undefined" === typeof encoding) {
				throw new ReferenceError("missing \"callback\" argument");
			}
				else if ("function" !== typeof callback && "function" !== typeof separator && "function" !== typeof encoding) {
					throw new TypeError("\"callback\" argument is not a function");
				}
			else {

				let _callback = callback;

				if ("undefined" === typeof _callback) {

					if ("undefined" === typeof separator) {
						_callback = encoding;
					}
					else {
						_callback = separator;
					}

				}

				filesToStreamProm(files, "string" === typeof separator ? separator : " ").then((readStream) => {

					return new Promise((resolve, reject) => {

						let data = "";
						let error = false;

						readStream.once("error", (_err) => {

							error = true;
							reject(_err);

						}).on("data", (chunk) => {
							data += chunk.toString("string" === typeof encoding ? encoding : "utf8");
						}).once("end", () => {

							if (!error) {
								resolve(data);
							}

						});

					});

				}).then((data) => {
					_callback(null, data);
				}).catch(_callback);

			}

		}
function _filesToString ( files , encoding , separator , callback ) { if ( "undefined" === typeof files ) { throw new ReferenceError ( "missing \"files\" argument" ) ; } else if ( "object" !== typeof files || ! ( files instanceof Array ) ) { throw new TypeError ( "\"files\" argument is not an Array" ) ; } else if ( "undefined" === typeof callback && "undefined" === typeof separator && "undefined" === typeof encoding ) { throw new ReferenceError ( "missing \"callback\" argument" ) ; } else if ( "function" !== typeof callback && "function" !== typeof separator && "function" !== typeof encoding ) { throw new TypeError ( "\"callback\" argument is not a function" ) ; } else { let _callback = callback ; if ( "undefined" === typeof _callback ) { if ( "undefined" === typeof separator ) { _callback = encoding ; } else { _callback = separator ; } } filesToStreamProm ( files , "string" === typeof separator ? separator : " " ) . then ( ( readStream ) => { return new Promise ( ( resolve , reject ) => { let data = "" ; let error = false ; readStream . once ( "error" , ( _err ) => { error = true ; reject ( _err ) ; } ) . on ( "data" , ( chunk ) => { data += chunk . toString ( "string" === typeof encoding ? encoding : "utf8" ) ; } ) . once ( "end" , ( ) => { if ( ! error ) { resolve ( data ) ; } } ) ; } ) ; } ) . then ( ( data ) => { _callback ( null , data ) ; } ) . catch ( _callback ) ; } }
methods 
Async filesToString
@param {Array} files : files to read
@param {string} encoding : encoding
@param {string} separator : files separator
@param {function|null} callback : operation's result
@returns {void}
methods Async filesToString