Retrieve file stream from storage

@param {string} namespace - location (folder) used to place saved file.
@param {string} fileName - filename that should be unique within namespace
496296
function streamFile(namespace, fileName) {
  var file;
  if (namespace) {
    file = path.join(namespace, fileName);
  } else {
    file = fileName;
  }
  var deferred = q.defer();
  var paramsStream = {
    Bucket: config.bucket,
    Key: file
  };
  try {
    var stream = awsClient.downloadStream(paramsStream);
    deferred.resolve(stream);
  } catch (error) {
    console.log(error);
    deferred.reject(error);
  }
  return deferred.promise;
}
1070188
public static File saveFile(String name, String data) {
        if (name == null) {
            name = "";
        }
        String fullyQualifiedName = name;

        /**
         * if filename is not absolute use current path as base dir
         */
        if (!new File(fullyQualifiedName).isAbsolute()) {
            fullyQualifiedName = Paths.get("").toAbsolutePath().toString() + "/" + name;
        }
        try {
            //create subdirs (if there any)
            if (fullyQualifiedName.contains("/")) {
                File f = new File(fullyQualifiedName.substring(0, fullyQualifiedName.lastIndexOf("/")));
                f.mkdirs();
            }
            File file = new File(fullyQualifiedName);
            file.createNewFile();
            FileUtils.write(file, data, "UTF-8");
            log.info("Wrote: " + file.getAbsolutePath());
            return file;
        } catch (IOException e) {
            log.log(Level.SEVERE, "Could not create file " + name, e);
            return null;
        }
    }
950046
async function writeStream (filename, contents) {
  await new Promise((resolve, reject) => {
    contents.pipe(fs.createWriteStream(filename))
      .on('finish', function () {
        resolve(filename)
      })
      .on('error', /* istanbul ignore next */ function (err) {
        reject(err)
      })
  })
  return filename
}
504165
function( fileName)
    //------------------------------------------------------------------------------------------------------
    {
        // if you want onEventName to work, send options to Events
        // otherwise send nothing
        // but you must call it or throws
        var logDir = path.join(path.dirname(require.main), 'logs');

        if (!fs.existsSync(logDir)){
            fs.mkdirSync(logDir);
        }

        this.fileName = fileName;

        this.filePath = path.join(logDir, fileName);

        this.stream = fs.createWriteStream(this.filePath, {flags : 'a'});
    }
1320207
function string_src(filename, string) {
  var src = require('stream').Readable({ objectMode: true })
  src._read = function () {
    this.push(new gutil.File({ cwd: "", base: "", path: filename, contents: new Buffer(string) }))
    this.push(null)
  }
  return src
}
71005
function storeFileToDiskSync(i_oFile) {
    var l_sDirname = path.dirname(i_oFile.filename),
        l_sFilename,
        l_oStats,
        l_oBuffer;

    console.log("File name: ", i_oFile.filename, " size: ", i_oFile.header.unpackedSize);
    console.log("Saving content of file ");

    l_sDirname = path.dirname(i_oFile.filename);
    l_sFilename = path.join(__dirname, path.basename(i_oFile.filename));
    l_oBuffer = new Buffer(i_oFile.fileData); // filedata is Uint8Array

    fs.writeFileSync(l_sFilename, l_oBuffer);
}
696721
function(className, namespace)
		{
			if (!className || !namespace) return;
			
			try
			{
				var classReference = namespace[className];
				
				if (conbo.isClass(classReference)) 
				{
					return classReference;
				}
			}
			catch (e) {}
		}
847165
function _bn_getFile(input) {
    // if there is custom file upload logic, for example, images are resized client-side
    // generated Blobs should be assigned to fileInput._file
    // and can be sent via ajax with FormData

    // if file was deleted, custom field can be set to an empty string

    // Bunny Validation detects if there is custom Blob assigned to file input
    // and uses this file for validation instead of original read-only input.files[]
    if (input._file !== undefined && input._file !== '') {
        if (input._file instanceof Blob === false) {
            console.error("Custom file for input " + input.name + " is not an instance of Blob");
            return false;
        }
        return input._file;
    }
    return input.files[0] || false;
}
205619
function FileInputStream(src){
    // wrap into Promise
    return new Promise(function(resolve, reject){

         // 
        const istream = _fs.createReadStream(src);
        istream.on('error', reject);
        istream.on('open', function(){
            resolve(istream);
        });
    });
}
762954
function getFilesizeInBytes(fileName) {
    try {
        var stats = fs.statSync(fileName);
        return stats.size || 0;
    } catch (ex) {
        console.log(ex);
        return 0;
    }
}
867453
function getFileInfo (fileName) {
    var result = {};
    result.name = fileName;
    result.exists = fs.existsSync (fileName);
    if (result.exists) {
        var stats = fs.statSync (fileName);
        result.isFile = stats.isFile ();
        result.isDirectory = stats.isDirectory ();
    }
    else {
        result.isFile = false;
        result.isDirectory = false;
    }
    
    return (result);
}
444527
function pickFile(rootFolder, fileName) {
    var result = path.join(rootFolder, fileName);
    if (fs.existsSync(result)) {
        return result;
    }

    return undefined;
}
514938
function getNamespacedData(namespace, data){
        var namespacedData = {};
        for (var key in data){
            // key starts with namespace
            if (key.slice(0, namespace.length) == namespace){
                var namespacedKey = key.slice(namespace.length, key.length);
                namespacedKey = namespacedKey.charAt(0).toLowerCase() + namespacedKey.slice(1);
                namespacedData[namespacedKey] = data[key];
            }
        }

        return namespacedData;
    }
1186265
function verifyNamespace(namespace) {
	if (namespace && typeof namespace !== 'string') {
		const msg = util.format('Namespace must be a non-empty string: %j', namespace);
		logger.error('verifyNamespace:', msg);
		throw new Error(msg);
	}
}
1317269
function getNamespace(path){
    if (hasOwnProperty.call(namespaces, path))
      return namespaces[path];

    path = path.split('.');

    var rootNs = getRootNamespace(path[0]);
    var cursor = rootNs;

    for (var i = 1; i < path.length; i++)
    {
      var name = path[i];
      var nspath = path.slice(0, i + 1).join('.');

      if (!hasOwnProperty.call(rootNs.namespaces_, nspath))
      {
        // create new namespace
        var namespace = new Namespace(nspath);

        // cursor[name] = namespace;
        if (config.implicitExt)
        {
          cursor[name] = namespace;

          /** @cut */ if (config.implicitExt == 'warn')
          /** @cut */ {
          /** @cut */   cursor[name] = namespace;
          /** @cut */   warnPropertyAccess(cursor, name, namespace,
          /** @cut */     'basis.js: Access to implicit namespace `' + nspath + '`'
          /** @cut */   );
          /** @cut */ }
        }

        rootNs.namespaces_[nspath] = namespace;
      }

      cursor = rootNs.namespaces_[nspath];
    }

    namespaces[path.join('.')] = cursor;

    return cursor;
  }
297743
function (filePath) {
                    var
                        me = this,
                        extName = _path.extname(filePath).toLowerCase(),
                        size,
                        stream;
                    _fs.stat(filePath, function (err, stats) {
                        var mimeType;
                        if (err) {
                            me._response.plain(500,
                                "Unable to access file (" + err + ")");
                            return;
                        }
                        if (stats.isDirectory()) {
                            me._response.plain(200, "Directory.");
                            return;
                        } else if (!stats.isFile()) {
                            me._response.plain(200, "Not a file.");
                            return;
                        }
                        size = stats.size;
                        mimeType = gpf.http.getMimeType(extName);
                        if (me._options.verbose) {
                            console.log("\tMime type  : " + mimeType);
                            console.log("\tFile size  : " + size);
                        }
                        me._response.writeHead(200, {
                            "content-type": mimeType,
                            "content-length": size
                        });
                        stream = _fs.createReadStream(filePath);
                        //stream.on("data", function (chunk) {
                        //    if (!me._response.write(chunk)) {
                        //        stream.pause();
                        //        me._response.once("drain", function () {
                        //            stream.resume();
                        //        });
                        //    }
                        //});
                        stream.on("end", function () {
                            if (me._options.verbose) {
                                console.log("\tEnd      t+: "
                                + ((new Date()) - me._startTimeStamp)
                                + "ms");
                            }
                            me._response.statusCode = 200;
                            me._response.end();
                        });
                        stream.pipe(me._response);
                    });
                }
865884
function FileReadStream(path, options) {
  stream.Stream.call(this);
  this.readable = true;

  if(!options) {
    options = {};
  }

  this._destroyed = false;
  this._streamEnded = false;
  this._fd = null;
  this._fileName = undefined;
  this._highWaterMark = options.highWaterMark || bufferSize;
  this._offset = 0;
  this._paused = undefined;
  this._allocator = options.allocator;
  this._fileName = path;

  this._md5hash = null;
  this._md5sum = undefined;

  if (options.calcContentMd5) {
    this._md5hash = new Md5Wrapper().createMd5Hash();
  }

  this._open();
}