27 lines
592 B
Go
27 lines
592 B
Go
package webfilesystem
|
|
|
|
import "go.mongodb.org/mongo-driver/bson/primitive"
|
|
|
|
func (fs *WebFileSystem) Read(filePath string, fileData interface{}) (*FileHeader, error) {
|
|
fileId, err := fs.FindFile(filePath)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
fileHeader, err := fs.readFSDocs(fileId, fileData)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return fileHeader, nil
|
|
}
|
|
|
|
func (fs *WebFileSystem) ReadByObjectID(fileID primitive.ObjectID, fileData interface{}) (*FileHeader, error) {
|
|
fileHeader, err := fs.readFSDocs(fileID, fileData)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return fileHeader, nil
|
|
}
|