code: func Import(name string, s Writer, reader io.Reader) error {
  	tr := tar.NewReader(reader)
  	tlsData := ContextTLSData{
  		Endpoints: map[string]EndpointTLSData{},
  	}
  	for {
  		hdr, err := tr.Next()
  		if err == io.EOF {
  			break
  		}
  		if err != nil {
  			return err
  		}
  		if hdr.Typeflag == tar.TypeDir {
  			// skip this entry, only taking files into account
  			continue
  		}
  		if hdr.Name == metaFile {
  			data, err := ioutil.ReadAll(tr)
  			if err != nil {
  				return err
  			}
  			var meta Metadata
  			if err := json.Unmarshal(data, &meta); err != nil {
  				return err
  			}
  			meta.Name = name
  			if err := s.CreateOrUpdate(meta); err != nil {
  				return err
  			}
  		} else if strings.HasPrefix(hdr.Name, "tls/") {
  			relative := strings.TrimPrefix(hdr.Name, "tls/")
  			parts := strings.SplitN(relative, "/", 2)
  			if len(parts) != 2 {
  				return errors.New("archive format is invalid")
  			}
  			endpointName := parts[0]
  			fileName := parts[1]
  			data, err := ioutil.ReadAll(tr)
  			if err != nil {
  				return err
  			}
  			if _, ok := tlsData.Endpoints[endpointName]; !ok {
  				tlsData.Endpoints[endpointName] = EndpointTLSData{
  					Files: map[string][]byte{},
  				}
  			}
  			tlsData.Endpoints[endpointName].Files[fileName] = data
  		}
  	}
  	return s.ResetTLSMaterial(name, &tlsData)
  }
docs: // Import imports an exported context into a store