personal-website/webfilesystem/public.go

27 lines
592 B
Go
Raw Normal View History

2023-05-07 01:00:22 +00:00
package webfilesystem
2023-05-10 12:39:49 +00:00
import "go.mongodb.org/mongo-driver/bson/primitive"
2023-05-07 01:00:22 +00:00
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
}
2023-05-10 12:39:49 +00:00
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
}