// WriteToFile put them to a file will be overwritten or created
774592
func (hp HashedPasswords) WriteToFile(file string) error {
	return ioutil.WriteFile(file, hp.Bytes(), 0644)
}
287518
func (f File) WriteTo(w io.Writer) (int64, error) {
	n, err := w.Write(f.data)
	return int64(n), err
}
43337
func ToFile(w io.Writer, level int) Logger {
	return file{w, level}
}
473388
func (p *AssetPath) WriteTo(out io.Writer) (int64, error) {
	data, err := p.ReadFile()
	if err != nil {
		return 0, err
	}
	n, err := out.Write(data)
	return int64(n), err
}
991668
func (p *SwiftPath) WriteTo(out io.Writer) (int64, error) {
	glog.V(4).Infof("Reading file %q", p)

	opt := swiftobject.DownloadOpts{}
	result := swiftobject.Download(p.client, p.bucket, p.key, opt)
	if result.Err != nil {
		if isSwiftNotFound(result.Err) {
			return 0, os.ErrNotExist
		}
		return 0, fmt.Errorf("error reading %s: %v", p, result.Err)
	}
	defer result.Body.Close()

	return io.Copy(out, result.Body)
}
918791
func (f *SyncFromServerFile) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (n int, err error) {
	f.folder.fs.logEnter(ctx, "SyncFromServerFile Write")
	defer func() { f.folder.reportErr(ctx, libkbfs.WriteMode, err) }()
	if len(bs) == 0 {
		return 0, nil
	}
	folderBranch := f.folder.getFolderBranch()
	if folderBranch == (data.FolderBranch{}) {
		// Nothing to do.
		return len(bs), nil
	}
	err = f.folder.fs.config.KBFSOps().SyncFromServer(
		ctx, folderBranch, nil)
	if err != nil {
		return 0, err
	}
	f.folder.fs.NotificationGroupWait()
	return len(bs), nil
}
1162742
func (f *UpdatesFile) WriteFile(ctx context.Context, fi *dokan.FileInfo, bs []byte, offset int64) (n int, err error) {
	f.folder.fs.logEnter(ctx, "UpdatesFile WriteFile")
	defer func() { f.folder.fs.reportErr(ctx, libkbfs.WriteMode, err) }()
	f.folder.fs.log.CDebugf(ctx, "UpdatesFile (enable: %t) Write", f.enable)
	if len(bs) == 0 {
		return 0, nil
	}

	f.folder.updateMu.Lock()
	defer f.folder.updateMu.Unlock()
	if f.enable {
		if f.folder.updateChan == nil {
			return 0, errors.New("Updates are already enabled")
		}
		err = libkbfs.RestartCRForTesting(
			libcontext.BackgroundContextWithCancellationDelayer(),
			f.folder.fs.config, f.folder.getFolderBranch())
		if err != nil {
			return 0, err
		}
		f.folder.updateChan <- struct{}{}
		close(f.folder.updateChan)
		f.folder.updateChan = nil
	} else {
		if f.folder.updateChan != nil {
			return 0, errors.New("Updates are already disabled")
		}
		f.folder.updateChan, err =
			libkbfs.DisableUpdatesForTesting(f.folder.fs.config,
				f.folder.getFolderBranch())
		if err != nil {
			return 0, err
		}
		err = libkbfs.DisableCRForTesting(f.folder.fs.config,
			f.folder.getFolderBranch())
		if err != nil {
			return 0, err
		}
	}
	// Because we store state in the folder it must not be forgotten
	// even if it appears empty and unused.
	f.folder.noForget = true

	return len(bs), err
}
56382
func (fs *Filespace) WriteFile(subPath string, data []byte, perm os.FileMode) error {
	return fs.root.WriteFile(subPath, data, perm)
}
783611
func (_m *RequesterVariadic) MultiWriteToFile(filename string, w ...io.Writer) string {
	_va := make([]interface{}, len(w))
	for _i := range w {
		_va[_i] = w[_i]
	}
	var _ca []interface{}
	_ca = append(_ca, filename)
	_ca = append(_ca, _va...)
	ret := _m.Called(_ca...)

	var r0 string
	if rf, ok := ret.Get(0).(func(string, ...io.Writer) string); ok {
		r0 = rf(filename, w...)
	} else {
		r0 = ret.Get(0).(string)
	}

	return r0
}
706483
func (b *FileBookmarks) writeToFile() (err error) {
	j, err := json.Marshal(b.bookmarks)
	if err != nil {
		return err
	}
	fout, err := os.Create(b.file)
	if err != nil {
		return err
	}
	defer func() {
		err = fout.Close()
	}()
	_, err = fout.Write(j)
	if err != nil {
		return err
	}

	return err
}
366504
func ToFile(path string) (*DebugPrinter, error) {
	file, err := os.Create(path)
	if err != nil {
		return nil, err
	}

	return &DebugPrinter{
		out: file,
	}, nil
}
125177
func (i Int) WriteTo(w io.Writer) (int64, error) {
	written, err := fmt.Fprintf(w, "%d", i)
	return int64(written), err
}
292266
func (c *Cert) writeKeyToFile(path string) error {
	pemfile, err := os.Create(path)
	if err != nil {
		return fmt.Errorf("failed to create pem key file for writting: %v", err)
	}

	if err := pem.Encode(pemfile, c.Data()); err != nil {
		return fmt.Errorf("failed to encode key to pem file at'%s': %v", path, err)
	}

	if err := pemfile.Close(); err != nil {
		return fmt.Errorf("error closing pem file at '%s': %v", path, err)
	}

	return nil
}
564567
func (h *fs) WriteFile(filename string, data []byte) error {
	return ioutil.WriteFile(filename, data, 0700)
}
1018065
func WriteFile(filename string, data []byte, perm os.FileMode) error {
	err := ioutil_base.WriteFile(filename, data, perm)
	if err != nil {
		return errors.Wrapf(err, "failed to write file %q", filename)
	}
	return nil
}
1364418
func writeFile(path string, contents []byte) {
	handleError(ioutil.WriteFile(path, contents, 0640))
}
502445
func (p *MemFSPath) WriteTo(out io.Writer) (int64, error) {
	if p.contents == nil {
		return 0, os.ErrNotExist
	}
	n, err := out.Write(p.contents)
	return int64(n), err
}