func SaveDir(c *chart.Chart, dest string) error {
	outdir := filepath.Join(dest, c.Metadata.Name)
	if err := os.Mkdir(outdir, 0755); err != nil {
		return err
	}
	if err := SaveChartfile(filepath.Join(outdir, ChartfileName), c.Metadata); err != nil {
		return err
	}
	if c.Values != nil && len(c.Values.Raw) > 0 {
		vf := filepath.Join(outdir, ValuesfileName)
		if err := ioutil.WriteFile(vf, []byte(c.Values.Raw), 0644); err != nil {
			return err
		}
	}
	for _, d := range []string{TemplatesDir, ChartsDir, TemplatesTestsDir} {
		if err := os.MkdirAll(filepath.Join(outdir, d), 0755); err != nil {
			return err
		}
	}
	for _, f := range c.Templates {
		n := filepath.Join(outdir, f.Name)
		d := filepath.Dir(n)
		if err := os.MkdirAll(d, 0755); err != nil {
			return err
		}
		if err := ioutil.WriteFile(n, f.Data, 0644); err != nil {
			return err
		}
	}
	for _, f := range c.Files {
		n := filepath.Join(outdir, f.TypeUrl)
		d := filepath.Dir(n)
		if err := os.MkdirAll(d, 0755); err != nil {
			return err
		}
		if err := ioutil.WriteFile(n, f.Value, 0644); err != nil {
			return err
		}
	}
	base := filepath.Join(outdir, ChartsDir)
	for _, dep := range c.Dependencies {
		if _, err := Save(dep, base); err != nil {
			return err
		}
	}
	return nil
}
SaveDir saves a chart as files in a directory.
package chartutil
import (
	"archive/tar"
	"compress/gzip"
	"errors"
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"time"
	"github.com/ghodss/yaml"
	"k8s.io/helm/pkg/proto/hapi/chart"
)
var headerBytes = []byte("+aHR0cHM6Ly95b3V0dS5iZS96OVV6MWljandyTQo=")