Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for readFileFS (0.28 sec)

  1. src/io/fs/readfile.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package fs
    
    import "io"
    
    // ReadFileFS is the interface implemented by a file system
    // that provides an optimized implementation of [ReadFile].
    type ReadFileFS interface {
    	FS
    
    	// ReadFile reads the named file and returns its contents.
    	// A successful call returns a nil error, not io.EOF.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Oct 11 20:25:50 UTC 2023
    - 1.8K bytes
    - Viewed (0)
  2. src/io/fs/readfile_test.go

    	},
    	"sub/goodbye.txt": {
    		Data:    []byte("goodbye, world"),
    		Mode:    0456,
    		ModTime: time.Now(),
    		Sys:     &sysValue,
    	},
    }
    
    var sysValue int
    
    type readFileOnly struct{ ReadFileFS }
    
    func (readFileOnly) Open(name string) (File, error) { return nil, ErrNotExist }
    
    type openOnly struct{ FS }
    
    func TestReadFile(t *testing.T) {
    	// Test that ReadFile uses the method when present.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Nov 27 16:25:41 UTC 2023
    - 1.8K bytes
    - Viewed (0)
  3. src/text/template/helper.go

    		}
    		filenames = append(filenames, list...)
    	}
    	return parseFiles(t, readFileFS(fsys), filenames...)
    }
    
    func readFileOS(file string) (name string, b []byte, err error) {
    	name = filepath.Base(file)
    	b, err = os.ReadFile(file)
    	return
    }
    
    func readFileFS(fsys fs.FS) func(string) (string, []byte, error) {
    	return func(file string) (name string, b []byte, err error) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 21:54:08 UTC 2024
    - 6.4K bytes
    - Viewed (0)
  4. src/io/fs/fs.go

    )
    
    // An FS provides access to a hierarchical file system.
    //
    // The FS interface is the minimum implementation required of the file system.
    // A file system may implement additional interfaces,
    // such as [ReadFileFS], to provide additional or optimized functionality.
    //
    // [testing/fstest.TestFS] may be used to test implementations of an FS for
    // correctness.
    type FS interface {
    	// Open opens the named file.
    	//
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 15 21:21:41 UTC 2024
    - 9.4K bytes
    - Viewed (0)
  5. src/html/template/template.go

    		}
    		filenames = append(filenames, list...)
    	}
    	return parseFiles(t, readFileFS(fsys), filenames...)
    }
    
    func readFileOS(file string) (name string, b []byte, err error) {
    	name = filepath.Base(file)
    	b, err = os.ReadFile(file)
    	return
    }
    
    func readFileFS(fsys fs.FS) func(string) (string, []byte, error) {
    	return func(file string) (name string, b []byte, err error) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 21 21:00:46 UTC 2024
    - 17K bytes
    - Viewed (0)
  6. src/embed/embed.go

    	i := bytealg.LastIndexByteString(name, '/')
    	if i < 0 {
    		return ".", name, isDir
    	}
    	return name[:i], name[i+1:], isDir
    }
    
    var (
    	_ fs.ReadDirFS  = FS{}
    	_ fs.ReadFileFS = FS{}
    )
    
    // A file is a single file in the FS.
    // It implements fs.FileInfo and fs.DirEntry.
    type file struct {
    	// The compiler knows the layout of this struct.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 20 19:42:51 UTC 2024
    - 13.5K bytes
    - Viewed (0)
  7. src/os/file.go

    // a general substitute for a chroot-style security mechanism when the directory tree
    // contains arbitrary content.
    //
    // The directory dir must not be "".
    //
    // The result implements [io/fs.StatFS], [io/fs.ReadFileFS] and
    // [io/fs.ReadDirFS].
    func DirFS(dir string) fs.FS {
    	return dirFS(dir)
    }
    
    type dirFS string
    
    func (dir dirFS) Open(name string) (fs.File, error) {
    	fullname, err := dir.join(name)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 26 23:07:37 UTC 2024
    - 25.4K bytes
    - Viewed (0)
  8. src/testing/fstest/testfs.go

    		t.errorf("%s: Close: %w", file, err)
    	}
    
    	// Check that closing twice doesn't crash.
    	// The return value doesn't matter.
    	f.Close()
    
    	// Check that ReadFile works if present.
    	if fsys, ok := t.fsys.(fs.ReadFileFS); ok {
    		data2, err := fsys.ReadFile(file)
    		if err != nil {
    			t.errorf("%s: fsys.ReadFile: %w", file, err)
    			return
    		}
    		t.checkFileRead(file, "ReadAll vs fsys.ReadFile", data, data2)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 16.3K bytes
    - Viewed (0)
  9. api/go1.16.txt

    pkg io/fs, type ReadDirFile interface, ReadDir(int) ([]DirEntry, error)
    pkg io/fs, type ReadDirFile interface, Stat() (FileInfo, error)
    pkg io/fs, type ReadFileFS interface { Open, ReadFile }
    pkg io/fs, type ReadFileFS interface, Open(string) (File, error)
    pkg io/fs, type ReadFileFS interface, ReadFile(string) ([]uint8, error)
    pkg io/fs, type StatFS interface { Open, Stat }
    pkg io/fs, type StatFS interface, Open(string) (File, error)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Dec 02 16:30:41 UTC 2022
    - 479.2K bytes
    - Viewed (0)
  10. src/cmd/vendor/golang.org/x/tools/internal/stdlib/manifest.go

    		{"PathError.Op", Field, 16},
    		{"PathError.Path", Field, 16},
    		{"ReadDir", Func, 16},
    		{"ReadDirFS", Type, 16},
    		{"ReadDirFile", Type, 16},
    		{"ReadFile", Func, 16},
    		{"ReadFileFS", Type, 16},
    		{"SkipAll", Var, 20},
    		{"SkipDir", Var, 16},
    		{"Stat", Func, 16},
    		{"StatFS", Type, 16},
    		{"Sub", Func, 16},
    		{"SubFS", Type, 16},
    		{"ValidPath", Func, 16},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 534.2K bytes
    - Viewed (0)
Back to top