Exemplo n.º 1
0
func GetBlock(apiClient drive.APIClient, hash string, offsetBytes uint64) (io.Reader, error) {
	apiGetBlockClient, err := apiClient.GetBlock(
		context.Background(),
		&drive.GetBlockRequest{
			Block: &drive.Block{
				Hash: hash,
			},
			OffsetBytes: offsetBytes,
		},
	)
	if err != nil {
		return nil, err
	}
	return protostream.NewStreamingBytesReader(apiGetBlockClient), nil
}