in internal/cmds/cmds.go [272:300]
func appendToBlob(sourceFilePath string, appendBlobRef *storage.Blob, appendBlobClient *appendblob.Client, outputFilePosition int64, ctx *log.Context) (int64, error) {
var err error
var newOutput []byte
if appendBlobRef != nil || appendBlobClient != nil {
// Save to blob
newOutput, err = files.GetFileFromPosition(sourceFilePath, outputFilePosition)
if err == nil {
newOutputSize := len(newOutput)
if newOutputSize > 0 {
if appendBlobRef != nil {
err = appendBlobRef.AppendBlock(newOutput, nil)
} else if appendBlobClient != nil {
ctx.Log("message", fmt.Sprintf("inside appendBlobClient. Output is '%s'", newOutput))
_, err = appendBlobClient.AppendBlock(context.Background(), streaming.NopCloser(bytes.NewReader(newOutput)), nil)
}
if err == nil {
outputFilePosition += int64(newOutputSize)
} else {
ctx.Log("message", "AppendToBlob failed", "error", err)
}
}
} else {
ctx.Log("message", "AppendToBlob - GetFileFromPosition failed.", "error", err)
}
}
return outputFilePosition, err
}