func (c *Client) CopyToLocal(src string, dst string) error {
	remote, err := c.Open(src)
	if err != nil {
		return err
	}
	defer remote.Close()
	local, err := os.Create(dst)
	if err != nil {
		return err
	}
	defer local.Close()
	_, err = io.Copy(local, remote)
	return err
}
CopyToLocal copies the HDFS file specified by src to the local file at dst.
If dst already exists, it will be overwritten.
package hdfs
import (
	"io"
	"io/ioutil"
	"os"
	"os/user"
	hdfs "github.com/colinmarc/hdfs/protocol/hadoop_hdfs"
	"github.com/colinmarc/hdfs/rpc"
)
type Client struct {
	namenode *rpc.NamenodeConnection
	defaults *hdfs.FsServerDefaultsProto
}
func Username() (string, error) {
	username := os.Getenv("HADOOP_USER_NAME")
	if username != "" {
		return username, nil
	}
	currentUser, err := user.Current()
	if err != nil {
		return "", err
	}
	return currentUser.Username, nil
}
func New(address string) (*Client, error) {
	username, err := Username()
	if err != nil {
		return nil, err
	}
	return NewForUser(address, username)
}
func NewForUser(address string, user string) (*Client, error) {
	namenode, err := rpc.NewNamenodeConnection(address, user)
	if err != nil {
		return nil, err
	}
	return &Client{namenode: namenode}, nil
}
func (c *Client) ReadFile(filename string) ([]byte, error) {
	f, err := c.Open(filename)
	if err != nil {
		return nil, err
	}
	defer f.Close()
	return ioutil.ReadAll(f)
}