github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/kbfs/libfuse/file_info_file.go (about)

     1  // Copyright 2018 Keybase Inc. All rights reserved.
     2  // Use of this source code is governed by a BSD
     3  // license that can be found in the LICENSE file.
     4  //
     5  //go:build !windows
     6  // +build !windows
     7  
     8  package libfuse
     9  
    10  import (
    11  	"time"
    12  
    13  	"github.com/keybase/client/go/kbfs/libfs"
    14  	"github.com/keybase/client/go/kbfs/libkbfs"
    15  	"golang.org/x/net/context"
    16  )
    17  
    18  // NewFileInfoFile returns a special file that contains a text
    19  // representation of a file's KBFS metadata.
    20  func NewFileInfoFile(
    21  	fs *FS, dir libkbfs.Node, name string,
    22  	entryValid *time.Duration) *SpecialReadFile {
    23  	*entryValid = 0
    24  	return &SpecialReadFile{
    25  		read: func(ctx context.Context) ([]byte, time.Time, error) {
    26  			return libfs.GetFileInfo(ctx, fs.config, dir, name)
    27  		},
    28  	}
    29  }