Return a docflux transformer function

@param  {String} path
Code source to read (relative path)

@return {Function}
Function for async.js
196902
function flux (path) {
  return function (done) {
    fs.createReadStream(resolve(__dirname, path))
      .pipe(docflux())
      .pipe(docflux.markdown({depth: DEPTH, indent: INDENT}))
      .pipe(concat(function (data) {
        done(null, data.toString())
      }))
  }
}
711091
function grab(path, normalize) {
    if (normalize) {
      return (config.path + path) + ".js";
      //return (config.path + path).replace(/\.js$/, "") + ".js";
    } else {
      var xhr = new XMLHttpRequest;
      xhr.open("get", grab(path, TRUE), !TRUE);
      xhr.send(null);
      return xhr.responseText;
    }
  }
1325709
function _gpfReadWScript (path) {
    return new Promise(function (resolve) {
        var file = _gpfMsFSO.OpenTextFile(path, _GPF_FS_WSCRIPT_READING, false);
        resolve(file.ReadAll());
        file.Close();
    });
}
214755
async function getDataFile(filePath) {
  ensureFileExists(filePath);
  const fileInfo = path.parse(filePath);
  try {
    switch (fileInfo.ext) {
      case '.json':
        const fileContents = await readFile(filePath, 'utf8');
        return JSON.parse(fileContents);
        break;
      case '.yml':
      case '.yaml':
        return await readYamlFile(filePath);
        break;
    }
  } catch (err) {
    log.errorAndExit('Could not getDataFile', err);
  }
}
604419
function transform(path) {
    if (shouldProcess(path)) {
        const renderer = Renderer.forPath(path);
        transformer(path.node, renderer, buildErrorHandler(path));
        // replace the render call if present, else replace the JSX
        if (Renderer.isParent(path)) {
            path.parentPath.replaceWith(renderer.toFunctionCall());
        } else {
            path.replaceWith(renderer.toFunctionCall());
        }
    }
}
1180978
function parseFile(filePath, encoding, callback) {
	return fs.readFile(filePath, encoding, function(err, fileString) {
		if (err) {
			return callback(err);
		}

		fileString = expandIncludes(fileString, path.dirname(filePath));

		return parse(fileString, callback);
	});
}
1363697
function compileFileSync(
  buildDir /*: string */,
  moduleType /*: BsModuleFormat | 'js' */,
  path /*: string */,
) /*: string */ {
  try {
    runBuildSync(buildDir)
  } catch (e) {
    throw utils.processBsbError(e.output.toString())
  }

  const res = readFileSync(path)
  return utils.transformSrc(moduleType, res.toString())
}
414527
function(path, definitions) {
    path = path.replace(/^#\/definitions\//, '').split('/');

    var find = function(path, root) {
      var key = path.shift();
      if (!root[key]) {
        return {};
      } else if (!path.length) {
        return root[key];
      } else {
        return find(path, root[key]);
      }
    };

    var result = find(path, definitions);

    if (!isObject(result)) {
      return result;
    }
    return cloneJSON(result);
  }
927384
async function readDirectory(sftp, path) {
  return new Promise(resolve => {
    sftp.readdir(path, (error, list) => {
      resolve(list || null);
    });
  });
}
34589
function getComments(path) {
  var source = fs.readFileSync(path, 'utf8');
  var comments = parseComments(source, true);
  var values = comments.map(function (comment) {
    return comment.value;
  });
  return parseJSDocs(values.join('\n'), { unwrap: true });
}
105041
function readChunk(path, start, end, callback) {
  if (end < 0) {
    return readLastChunk(path, start, end, callback);
  }
  var stream = nodeFs.createReadStream(path, {
    start: start,
    end: end - 1
  });
  var chunks = [];
  stream.on("readable", function () {
    var chunk = stream.read();
    if (chunk === null) return callback(null, Buffer.concat(chunks));
    return chunks.push(chunk);
  });
  stream.on("error", function (err) {
    if (err.code === "ENOENT") return callback();
    return callback(err);
  });
}
169044
function readSync( path, options ) {
	var file,
		opts;

	if (
		arguments.length > 1 &&
		!isString( options )
	) {
		opts = options;
	} else {
		opts = {};
	}
	opts.encoding = 'utf8';
	file = readFile.sync( path, opts );
	if ( file instanceof Error ) {
		return file;
	}
	return parse( file, opts );
}
772846
function(filePath, callback) {
    var text = fs.readFileSync(path.resolve(filePath), 'utf8');
    return this.executeOnText(text, filePath, callback);
  }
110
function readFile(path, fileName) {
  return new Promise((resolve, reject) => {
    fs.readFile(`${path}/${fileName}`, 'utf8', (err, content) => {
      if (err) {
        return reject(err)
      }

      return resolve(content)
    })
  })
}
421312
function buildErrorHandler(path) {
    return function(node, text) {
        throw path.hub.file.buildCodeFrameError(node, text);
    }
}
409912
function(src, dest, transform) {
        if (typeof src !== 'string' || src.length === 0) {
            throw 'Invalid source file path (arg #1)';
        }
        if (typeof dest !== 'string' || dest.length === 0) {
            throw 'Invalid destination file path (arg #2)';
        }
        if (typeof transform !== 'function') {
            transform = function(data) {
                return data;
            };
        }

        var def = _promise.deferred();
        _fs.readFile(src, function(err, data) {
            if (err) {
                def.reject(err);
            } else {
                var data = transform(data.toString());
                _fs.writeFile(dest, data, function(err, data) {
                    if (err) {
                        def.reject(err);
                    } else {
                        def.resolve();
                    }
                });
            }
        });

        return def.promise();
    }
570978
function (path, minify, encode) {
        minify = minify || false;
        encode = encode || 'utf-8';

        if (this.isFileSync(path)) {
            var raw = fs.readFileSync(path, encode);
            if (minify) {
                raw = jsonminify(raw);
            }

            try {
                return JSON.parse(raw);
            } catch (e1) {
                try {
                    jsonlint.parse(raw);
                } catch (e2) {
                    throw e2;
                }
            }
        }
        return {};
    }