Created
January 30, 2020 18:19
-
-
Save dalibormesaric/57895b16b98f421c5e7021dd78b1a721 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "Microsoft.Azure.WebJobs.Extensions.Storage" | |
public static async Task Run(Stream myBlob, Binder binder, string name, ILogger log) | |
{ | |
if (name.Contains("_")) return; | |
log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes"); | |
var fileName = Path.GetFileNameWithoutExtension(name); | |
var fileExtension = Path.GetExtension(name); | |
var duplicateName = $"{fileName}_{DateTime.UtcNow.ToString("yyyyMMddHHmmss")}{fileExtension}"; | |
var blobAttribute = new BlobAttribute($"samples-workitems/{duplicateName}", FileAccess.Write); | |
using (var output = await binder.BindAsync<Stream>(blobAttribute)) | |
{ | |
await myBlob.CopyToAsync(output); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment