// AddFile implementation for Google Cloud Storage Data Backend
AddFile implementation for Google Cloud Storage Data Backend
// AddFile implementation for Google Cloud Storage Data Backend
func (sb *Backend) AddFile(file *common.File, fileReader io.Reader) (err error) {
	err = sb.initClient()
	if err != nil {
		err = fmt.Errorf("unable to get gcs client: %s", err)
		return
	}
	wc := sb.client.Bucket(sb.Config.Bucket).Object(sb.getFileID(file.UploadID, file.ID)).NewWriter(context.Background())
	defer wc.Close()
	_, err = io.Copy(wc, fileReader)
	if err != nil {
		return
	}
	return
}
func ( sb * Backend ) AddFile ( file * common . File , fileReader io . Reader ) ( err error ) { err = sb . initClient ( ) if err != nil { err = fmt . Errorf ( " " , err ) return } wc := sb . client . Bucket ( sb . Config . Bucket ) . Object ( sb . getFileID ( file . UploadID , file . ID ) ) . NewWriter ( context . Background ( ) ) defer wc . Close ( ) _ , err = io . Copy ( wc , fileReader ) if err != nil { return } return }
AddFile implementation for Google Cloud Storage Data Backend
AddFile implementation for Google Cloud Storage Data Backend
// Get the GCS client // Get a writer