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)
| 67 | // BlobRef is of the JSON file schema blob. |
| 68 | // Both filename and modTime are optional. |
| 69 | func 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 |