// New creates a new file system with the registered zip contents data.
// It unzips all files and stores them in an in-memory map.
331682
func New() (http.FileSystem, error) {
	if zipData == "" {
		return nil, errors.New("statik/fs: no zip data registered")
	}
	zipReader, err := zip.NewReader(strings.NewReader(zipData), int64(len(zipData)))
	if err != nil {
		return nil, err
	}
	files := make(map[string]file, len(zipReader.File))
	dirs := make(map[string][]string)
	fs := &statikFS{files: files, dirs: dirs}
	for _, zipFile := range zipReader.File {
		fi := zipFile.FileInfo()
		f := file{FileInfo: fi, fs: fs}
		f.data, err = unzip(zipFile)
		if err != nil {
			return nil, fmt.Errorf("statik/fs: error unzipping file %q: %s", zipFile.Name, err)
		}
		files["/"+zipFile.Name] = f
	}
	for fn := range files {
		// go up directories recursively in order to care deep directory
		for dn := path.Dir(fn); dn != fn; {
			if _, ok := files[dn]; !ok {
				files[dn] = file{FileInfo: dirInfo{dn}, fs: fs}
			} else {
				break
			}
			fn, dn = dn, path.Dir(dn)
		}
	}
	for fn := range files {
		dn := path.Dir(fn)
		if fn != dn {
			fs.dirs[dn] = append(fs.dirs[dn], path.Base(fn))
		}
	}
	for _, s := range fs.dirs {
		sort.Strings(s)
	}
	return fs, nil
}
397338
func New(config Config) *Cache {
	return &Cache{
		m:      make(map[Key]*list.Element, config.MaxItems),
		l:      list.New(),
		config: config,
	}
}
53258
func New(dir, passphrase string) (*Config, error) {
	if dir == "" || dir == "." {
		return nil, fmt.Errorf("dir must not be empty")
	}
	fn := filepath.Join(dir, filename)

	c := &Config{
		filename:   fn,
		passphrase: passphrase,
	}

	if !fsutil.IsFile(fn) {
		err := save(c.filename, c.passphrase, map[string]string{})
		return c, err
	}

	_, err := c.Get("")
	if err != nil {
		return nil, errors.Wrapf(err, "failed to open existing secrects config %s: %s", fn, err)
	}
	return c, nil
}
242652
func New(apiKey string) *Linode {
	return &Linode{
		apiEndpoint: ApiEndpoint,
		apiKey:      apiKey,
		actions:     []Action{},
	}
}
492428
func New(w io.Writer) Package {
	return Package{
		z:        zip.NewWriter(w),
		manifest: make(map[string]string),
	}
}
669650
func New(c *tlc.Container, source wsync.Pool, cache wsync.WritablePool) *CachePool {
	cp := &CachePool{
		container: c,
		source:    source,
		cache:     cache,
		fileChans: make([]chan struct{}, len(c.Files)),
	}

	for i := range cp.fileChans {
		cp.fileChans[i] = make(chan struct{})
	}

	return cp
}
589426
func New(fs fs.FileSystem) Tar {
	return &stiTar{
		FileSystem: fs,
		exclude:    DefaultExclusionPattern,
		timeout:    defaultTimeout,
	}
}
395897
func New(ctx context.Context, cfg *config.Config) (*Store, error) {
	if cfg == nil {
		cfg = &config.Config{}
	}
	if cfg.Root != nil && (cfg.Root.Path == nil || cfg.Root.Path.Path == "") {
		cfg.Root.Path = backend.FromPath(config.PwStoreDir(""))
	}
	r := &Store{
		cfg:    cfg,
		mounts: make(map[string]store.Store, len(cfg.Mounts)),
		url:    cfg.Root.Path,
	}

	return r, nil
}
697706
func New(cfg map[config.Set]Files) config.Interface {
	return &memoryImpl{sets: cfg}
}
859909
func New(bdb *bolt.DB) *DB {
	return &DB{
		rootBuckets: make(map[string]*bucketMeta),
		bdb:         bdb,
	}
}
781242
func NewZip(dest io.Writer) *Zip {
	writer := zip.NewWriter(dest)

	writer.RegisterCompressor(zip.Deflate, func(out io.Writer) (io.WriteCloser, error) {
		return flate.NewWriter(out, flate.DefaultCompression)
	})

	return &Zip{writer: writer}
}
331588
func New(name string) (*Store, error) {
	home, err := homedir.Dir()
	if err != nil {
		return nil, err
	}
	base := filepath.Join(home, ".config", name)

	// create directory
	err = os.MkdirAll(base, os.ModePerm)
	if err != nil {
		return nil, err
	}

	return &Store{Base: base}, nil
}
958378
func New(params driverParameters) (storagedriver.StorageDriver, error) {
	rootDirectory := strings.Trim(params.rootDirectory, "/")
	if rootDirectory != "" {
		rootDirectory += "/"
	}
	if params.chunkSize <= 0 || params.chunkSize%minChunkSize != 0 {
		return nil, fmt.Errorf("Invalid chunksize: %d is not a positive multiple of %d", params.chunkSize, minChunkSize)
	}
	d := &driver{
		bucket:        params.bucket,
		rootDirectory: rootDirectory,
		email:         params.email,
		privateKey:    params.privateKey,
		client:        params.client,
		chunkSize:     params.chunkSize,
	}

	return &Wrapper{
		baseEmbed: baseEmbed{
			Base: base.Base{
				StorageDriver: base.NewRegulator(d, params.maxConcurrency),
			},
		},
	}, nil
}
87132
func (api *GSLBAPI) New(name string) *sacloud.GSLB {
	return sacloud.CreateNewGSLB(name)
}
653471
func New(opts *FileKeyValueStoreOptions) (*FileKeyValueStore, error) {
	if opts == nil {
		return nil, errors.New("FileKeyValueStoreOptions is nil")
	}
	if opts.Path == "" {
		return nil, errors.New("FileKeyValueStore path is empty")
	}
	if opts.KeySerializer == nil {
		// Default key serializer
		opts.KeySerializer = func(key interface{}) (string, error) {
			keyString, ok := key.(string)
			if !ok {
				return "", errors.New("converting key to string failed")
			}
			return filepath.Join(opts.Path, keyString), nil
		}
	}
	if opts.Marshaller == nil {
		opts.Marshaller = defaultMarshaller
	}
	if opts.Unmarshaller == nil {
		opts.Unmarshaller = defaultUnmarshaller
	}
	return &FileKeyValueStore{
		path:          opts.Path,
		keySerializer: opts.KeySerializer,
		marshaller:    opts.Marshaller,
		unmarshaller:  opts.Unmarshaller,
	}, nil
}
786023
func New(c *tlc.Container, zipReader *zip.Reader) *ZipPool {
	fmap := make(map[string]*zip.File)
	for _, f := range zipReader.File {
		info := f.FileInfo()

		if info.IsDir() {
			// muffin
		} else if (info.Mode() & os.ModeSymlink) > 0 {
			// muffin ether
		} else {
			key := filepath.ToSlash(filepath.Clean(f.Name))
			fmap[key] = f
		}
	}

	return &ZipPool{
		container: c,
		fmap:      fmap,

		fileIndex: int64(-1),
		reader:    nil,

		seekFileIndex: int64(-1),
		readSeeker:    nil,
	}
}
561718
func New(target io.Writer) Archive {
	gw := gzip.NewWriter(target)
	return Archive{
		gw: gw,
	}
}