MCPcopy
hub / github.com/perkeep/perkeep / WriteFileFromReaderWithModTime

Function WriteFileFromReaderWithModTime

pkg/schema/filewriter.go:69–79  ·  view source on GitHub ↗

WriteFileFromReaderWithModTime creates and uploads a "file" JSON schema composed of chunks of r, also uploading the chunks. The returned BlobRef is of the JSON file schema blob. Both filename and modTime are optional.

(ctx context.Context, bs blobserver.StatReceiver, filename string, modTime time.Time, r io.Reader)

Source from the content-addressed store, hash-verified

67// BlobRef is of the JSON file schema blob.
68// Both filename and modTime are optional.
69func WriteFileFromReaderWithModTime(ctx context.Context, bs blobserver.StatReceiver, filename string, modTime time.Time, r io.Reader) (blob.Ref, error) {
70 if strings.Contains(filename, "/") {
71 return blob.Ref{}, fmt.Errorf("schema.WriteFileFromReader: filename %q shouldn't contain a slash", filename)
72 }
73
74 m := NewFileMap(filename)
75 if !modTime.IsZero() {
76 m.SetModTime(modTime)
77 }
78 return WriteFileMap(ctx, bs, m, r)
79}
80
81// WriteFileFromReader creates and uploads a "file" JSON schema
82// composed of chunks of r, also uploading the chunks. The returned

Callers 3

TestS3WriteFilesFunction · 0.92
serveUploadHelperMethod · 0.92
WriteFileFromReaderFunction · 0.85

Calls 4

NewFileMapFunction · 0.85
WriteFileMapFunction · 0.85
ContainsMethod · 0.80
SetModTimeMethod · 0.80

Tested by 1

TestS3WriteFilesFunction · 0.74