/// <summary> /// Load data inside storage and returns as Stream /// </summary> public LiteFileStream OpenRead(string id) { if (string.IsNullOrEmpty(id)) { throw new ArgumentNullException("id"); } var doc = _engine.Find(FILES, Query.EQ("_id", new BsonValue(id))).FirstOrDefault(); if (doc == null) { return(null); } return(this.OpenRead(new LiteFileInfo(doc))); }
private byte[] GetChunkData(int index) { // check if there is no more chunks in this file var chunk = _engine .Find(LiteFileStorage.CHUNKS, Query.EQ("_id", LiteFileInfo.GetChunckId(FileInfo.Id, index))) .FirstOrDefault(); // if chunk is null there is no more chunks return(chunk == null ? null : chunk["data"].AsBinary); }