// ReadFile read an entire file into memory, and calls Read which
// parses the front matter data and returns the remaining file
// contents.
505155
func ReadFile(filename string, frontmatter interface{}) (content []byte, err error) {
	data, err := ioutil.ReadFile(filename)
	if err != nil {
		return nil, err
	}
	return Read(data, frontmatter)
}
56179
func (f *win32File) Read(b []byte) (int, error) {
	c, err := f.prepareIo()
	if err != nil {
		return 0, err
	}
	defer f.wg.Done()

	if f.readDeadline.timedout.isSet() {
		return 0, ErrTimeout
	}

	var bytes uint32
	err = syscall.ReadFile(f.handle, b, &bytes, &c.o)
	n, err := f.asyncIo(c, &f.readDeadline, bytes, err)
	runtime.KeepAlive(b)

	// Handle EOF conditions.
	if err == nil && n == 0 && len(b) != 0 {
		return 0, io.EOF
	} else if err == syscall.ERROR_BROKEN_PIPE {
		return 0, io.EOF
	} else {
		return n, err
	}
}
429766
func ReadFile(r Driver, filename string) ([]byte, error) {
	f, err := r.Open(filename)
	if err != nil {
		return nil, err
	}
	defer f.Close()

	data, err := ioutil.ReadAll(f)
	if err != nil {
		return nil, err
	}

	return data, nil
}
286323
func (fs *Filespace) ReadFile(subPath string) ([]byte, error) {
	return ioutil.ReadFile(fs.path + subPath)
}
453118
func (fsh *Handler) ReadFile(file string) ([]byte, error) {
	return ioutil.ReadFile(file)
}
202248
func (r *realFS) ReadFile(name string) ([]byte, error) {
	return ioutil.ReadFile(name)
}
930466
func readFile(ctxt *build.Context, filename string, buf *bytes.Buffer) ([]byte, error) {
	rc, err := buildutil.OpenFile(ctxt, filename)
	if err != nil {
		return nil, err
	}
	defer rc.Close()
	if buf == nil {
		buf = new(bytes.Buffer)
	}
	if _, err := io.Copy(buf, rc); err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}
637386
func LoadFile(filename string) (File, error) {
	file := make(File)
	err := file.LoadFile(filename)
	return file, err
}
58176
func (mock *Mock) ReadFile(file string) ([]byte, error) {
	items := mock.getReturnValues("ReadFile")
	if len(items) == 1 {
		switch typed := items[0].(type) {
		case []byte:
			return typed, nil
		case error:
			return []byte{}, typed
		}
	} else if len(items) == 2 {
		return items[0].([]byte), items[1].(error)
	}
	return []byte{}, nil
}
895767
func ReadFile(filename string, opts ...Option) (Node, error) {
	file, err := os.Open(filename)
	if err != nil {
		return nil, err
	}
	defer file.Close()
	return Read(file, opts...)
}
233164
func (t *Thermometer) readFile() (v *Value, err error) {
	t.lock.Lock()
	defer t.lock.Unlock()
	b, err := ioutil.ReadFile(t.devicePath)
	if err != nil {
		return v, err
	}
	return t.parseValue(string(b))
}
289917
func ReadFromFile(cnfPath string) ([]byte, error) {
	file, err := os.Open(cnfPath)

	// Config file not found
	if err != nil {
		return nil, fmt.Errorf("Open file error: %s", err)
	}

	// Config file found, let's try to read it
	data := make([]byte, 1000)
	count, err := file.Read(data)
	if err != nil {
		return nil, fmt.Errorf("Read from file error: %s", err)
	}

	return data[:count], nil
}
685063
func ReadFile(path string) ([]byte, error) {
	file, err := os.Open(path)
	if err != nil {
		return nil, err
	}
	defer Close(file)
	data, err := ioutil.ReadAll(file)
	if err != nil {
		return nil, err
	}
	return data, nil
}
907144
func (p *Pod) readFile(path string) ([]byte, error) {
	f, err := p.openFile(path, syscall.O_RDONLY)
	if err != nil {
		return nil, err
	}
	defer f.Close()

	return ioutil.ReadAll(f)
}
882538
func loadFile(path string, overload bool) error {
	env, err := ReadFile(path)
	if err != nil {
		return err
	}
	LoadMap(env, overload)
	return nil
}
130611
func (c *ConfigParser) ReadFile(path string) (Obj, error) {
	if path == "" && c.Open == nil {
		return nil, errors.New("ReadFile of empty string but Open hook not defined")
	}
	c.touchedFiles = make(map[string]bool)
	var err error
	c.rootJSON, err = c.recursiveReadJSON(path)
	return c.rootJSON, err
}
296454
func (fbh *FileBackupHandle) ReadFile(ctx context.Context, filename string) (io.ReadCloser, error) {
	if !fbh.readOnly {
		return nil, fmt.Errorf("ReadFile cannot be called on read-write backup")
	}
	p := path.Join(*FileBackupStorageRoot, fbh.dir, fbh.name, filename)
	return os.Open(p)
}