func (m *Module) Stream(s bar.Sink) {
	i, err := currentInfo.Get()
	nextInfo, done := currentInfo.Subscribe()
	defer done()
	outputFunc := m.outputFunc.Get().(func(Info) bar.Output)
	nextOutputFunc, done := m.outputFunc.Subscribe()
	defer done()
	for {
		if err != nil {
			s.Error(err)
		} else if info, ok := i.(Info); ok {
			s.Output(outputFunc(info))
		}
		select {
		case <-nextOutputFunc:
			outputFunc = m.outputFunc.Get().(func(Info) bar.Output)
		case <-nextInfo:
			i, err = currentInfo.Get()
		}
	}
}
Stream subscribes to meminfo and updates the module's output accordingly.
package meminfo  
import (
	"bufio"
	"strconv"
	"strings"
	"sync"
	"time"
	"barista.run/bar"
	"barista.run/base/value"
	"barista.run/format"
	l "barista.run/logging"
	"barista.run/outputs"
	"barista.run/timing"
	"github.com/martinlindhe/unit"
	"github.com/spf13/afero"
)
type Info map[string]unit.Datasize
func (i Info) FreeFrac(k string) float64 {
	return float64(i[k+"Free"]) / float64(i[k+"Total"])
}
func (i Info) Available() unit.Datasize {
	if avail, ok := i["MemAvailable"]; ok {
		return avail
	}
	return i["MemFree"] + i["Cached"] + i["Buffers"]
}
func (i Info) AvailFrac() float64 {
	return float64(i.Available()) / float64(i["MemTotal"])
}
var currentInfo = new(value.ErrorValue)  
var once sync.Once
var updater *timing.Scheduler
func construct() {
	once.Do(func() {
		updater = timing.NewScheduler()
		l.Attach(nil, &currentInfo, "meminfo.currentInfo")
		l.Attach(nil, updater, "meminfo.updater")
		updater.Every(3 * time.Second)
		update()
		go func(updater *timing.Scheduler) {
			for range updater.C {
				update()
			}
		}(updater)
	})
}
func RefreshInterval(interval time.Duration) {
	construct()
	updater.Every(interval)
}
type Module struct {
	outputFunc value.Value
}
func defaultOutput(i Info) bar.Output {
	return outputs.Textf("Mem: %s", format.IBytesize(i.Available()))
}
func New() *Module {
	construct()
	m := new(Module)
	l.Register(m, "outputFunc")
	m.Output(defaultOutput)
	return m
}
func (m *Module) Output(outputFunc func(Info) bar.Output) *Module {
	m.outputFunc.Set(outputFunc)
	return m
}