You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: iowriter.go
    path of file: ./repos/kubeedge/vendor/oras.land/oras-go/pkg/content
    
    the code of the file until where you have to start completion: /*
Copyright The ORAS Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package content

import (
	"context"
	"io"
	"io/ioutil"

	"github.com/containerd/container
    
func NewIoContentWriter(writer io.Writer, opts ...WriterOpt) content.Writer {
	w := writer
	if w == nil {
		w = ioutil.Discard
	}
	// process opts for default
	wOpts := DefaultWriterOpts()
	for _, opt := range opts {
		if err := opt(&wOpts); err != nil {
			return nil
		}
	}
	ioc := &IoContentWriter{
		writer:   w,
		digester: digest.Canonical.Digester(),
		// we take the OutputHash, since the InputHash goes to the passthrough writer,
		// which then passes the processed output to us
		hash: wOpts.OutputHash,
	}
	return NewPassthroughWriter(ioc, func(r io.Reader, w io.Writer, done chan<- error) {
		// write out the data to the io writer
		var (
			err error
		)
		// we could use io.Copy, but calling it with the default blocksize is identical to
		// io.CopyBuffer. Otherwise, we would need some way to let the user flag "I want to use
		// io.Copy", when it should not matter to them
		b := make([]byte, wOpts.Blocksize, wOpts.Blocksize)
		_, err = io.CopyBuffer(w, r, b)
		done <- err
	}, opts...)
}