I am using below Go MongoDB plugin MongoDB-GO-Driver to store ymal file data.
I am using gridfs.NewBucket()
method.
func (s *FS) CreateFilewithBytes(data []byte, filename string) error {
buf := bytes.NewBuffer(data)
chunksize, _ := binary.ReadVarint(buf)
_, err := gridfs.NewBucket(db,
options.GridFSBucket().
SetName(filename).
SetChunkSizeBytes(int32(chunksize))
if err != nil {
return err
}
}
Please help me out how to store file and read file data.