func (s *Stream) Write(p []byte) (int, error) {
	s.mu.Lock()
	defer s.mu.Unlock()
	n, err := s.file.Write(p)
	s.b.Wrote(n)
	return n, err
}
Write writes p to the Stream. It's concurrent safe to be called with Stream's other methods.
package stream
import (
	"errors"
	"sync"
)
var ErrUnsupported = errors.New("unsupported")
type Stream struct {
	mu        sync.Mutex
	b         *broadcaster
	file      File
	fs        FileSystem
	seekEnd   sizeOnce
	closeOnce onceWithErr
}
func New(name string) (*Stream, error) {
	return NewStream(name, StdFileSystem)
}
func NewStream(name string, fs FileSystem) (*Stream, error) {
	f, err := fs.Create(name)
	return newStream(f, fs), err
}
func NewMemStream() *Stream {
	f := newMemFile("")
	return newStream(f, singletonFs{f})
}
func newStream(file File, fs FileSystem) *Stream {
	return &Stream{
		file: file,
		fs:   fs,
		b:    newBroadcaster(),
	}
}
type singletonFs struct {
	file *memFile
}
func (fs singletonFs) Create(key string) (File, error) { return nil, ErrUnsupported }
func (fs singletonFs) Open(key string) (File, error) { return &memReader{memFile: fs.file}, nil }
func (fs singletonFs) Remove(key string) error { return ErrUnsupported }
func (s *Stream) Name() string { return s.file.Name() }