/// <summary> /// Copy all file content to a file /// </summary> public LiteFileInfo <TFileId> Download(TFileId id, string filename, bool overwritten) { var file = this.FindById(id) ?? throw LiteException.FileNotFound(id.ToString()); file.SaveAs(filename, overwritten); return(file); }
/// <summary> /// Copy all file content to a steam /// </summary> public LiteFileInfo <TFileId> Download(TFileId id, Stream stream) { var file = this.FindById(id) ?? throw LiteException.FileNotFound(id.ToString()); file.CopyTo(stream); return(file); }
/// <summary> /// Load data inside storage and returns as Stream /// </summary> public LiteFileStream <TFileId> OpenRead(TFileId id) { var file = this.FindById(id); if (file == null) { throw LiteException.FileNotFound(id.ToString()); } return(file.OpenRead()); }
/// <summary> /// Copy all file content to a steam /// </summary> public void Download(string id, Stream stream) { if (stream == null) { throw new ArgumentNullException("stream"); } var file = this.FindById(id); if (file == null) { throw LiteException.FileNotFound(id); } file.CopyTo(stream); }
/// <summary> /// Load data inside storage and returns as Stream /// </summary> public LiteFileStream OpenRead(string id) { if (string.IsNullOrEmpty(id)) { throw new ArgumentNullException("id"); } var file = this.FindById(id); if (file == null) { throw LiteException.FileNotFound(id); } return(file.OpenRead()); }
/// <summary> /// Copy all file content to a steam /// </summary> public LiteFileInfo Download(string id, Stream stream) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } var file = this.FindById(id); if (file == null) { throw LiteException.FileNotFound(id); } file.CopyTo(stream); return(file); }