func NewWriter(writer io.WriteSeeker, hasher hash.Hash64) (*Writer, error) {
	// Leave 256 * 8 * 2 bytes for the index at the head of the file.
	_, err := writer.Seek(0, os.SEEK_SET)
	if err != nil {
		return nil, err
	}

	_, err = writer.Write(make([]byte, headerSize))
	if err != nil {
		return nil, err
	}

	if hasher == nil {
		hasher = newCDBHash()
	}

	return &Writer{
		hasher:         hasher,
		writer:         writer,
		bufferedWriter: bufio.NewWriterSize(writer, 65536),
		bufferedOffset: headerSize,
	}, nil
}
// NewWriter opens a CDB database for the given io.WriteSeeker.
//
// If hasher is nil, it will default to the CDB hash function.
NewWriter opens a CDB database for the given io.WriteSeeker.

If hasher is nil, it will default to the CDB hash function.
// NewWriter opens a CDB database for the given io . WriteSeeker . // // If hasher is nil it will default to the CDB hash function .
func NewWriter(writer io.WriteSeeker, hasher hash.Hash64) (*Writer, error) {
	_, err := writer.Seek(0, os.SEEK_SET)
	if err != nil {
		return nil, err
	}
	_, err = writer.Write(make([]byte, headerSize))
	if err != nil {
		return nil, err
	}
	if hasher == nil {
		hasher = newCDBHash()
	}
	return &Writer{
		hasher:         hasher,
		writer:         writer,
		bufferedWriter: bufio.NewWriterSize(writer, 65536),
		bufferedOffset: headerSize,
	}, nil
}
func NewWriter ( writer io . WriteSeeker , hasher hash . Hash64 ) ( * Writer , error ) { _ , err := writer . Seek ( 0 , os . SEEK_SET ) if err != nil { return nil , err } _ , err = writer . Write ( make ( [ ] byte , headerSize ) ) if err != nil { return nil , err } if hasher == nil { hasher = newCDBHash ( ) } return & Writer { hasher : hasher , writer : writer , bufferedWriter : bufio . NewWriterSize ( writer , 65536 ) , bufferedOffset : headerSize , } , nil }
NewWriter opens a CDB database for the given io.WriteSeeker.
NewWriter opens a CDB database for the given io . WriteSeeker .
// Leave 256 * 8 * 2 bytes for the index at the head of the file.