Skip to content

Commit

Permalink
template update
Browse files Browse the repository at this point in the history
  • Loading branch information
aishwaryabh committed Jul 20, 2023
1 parent 026c206 commit daf6b58
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"Blob"
],
"name": "BlobTrigger",
"identity": "Azure.Function.CSharp.Isolated.BlobTrigger.4.x",
"identity": "Azure.Function.CSharp.Isolated.BlobTrigger.3.x",
"groupIdentity": "Azure.Function.BlobTrigger",
"shortName": "blob",
"tags": {
Expand Down Expand Up @@ -52,7 +52,7 @@
"args": {
"referenceType": "package",
"reference": "Microsoft.Azure.Functions.Worker.Extensions.Storage",
"version": "5.1.1-preview2",
"version": "6.0.0",
"projectFileExtensions": ".csproj"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ public BlobTriggerCSharp(ILogger<BlobTriggerCSharp> logger)
_logger = logger;
}

[Function(nameof(BlobClientFunction))]
[Function(nameof(BlobStreamFunction))]
public async Task Run(
[BlobTrigger(PathValue, Connection = "ConnectionValue")] BlobClient client)
[BlobTrigger(PathValue, Connection = "ConnectionValue")] Stream myBlob)
{
var downloadResult = await client.DownloadContentAsync();
var blobContent = downloadResult.Value.Content.ToString();
_logger.LogInformation("Blob content: {content}", blobContent);
using var blobStreamReader = new StreamReader(stream);
_logger.LogInformation("Blob content: {content}", await blobStreamReader.ReadToEndAsync());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Azure Function"
],
"name": "BlobTrigger",
"identity": "Azure.Function.FSharp.Isolated.BlobTrigger.4.x",
"identity": "Azure.Function.FSharp.Isolated.BlobTrigger.3.x",
"groupIdentity": "Azure.Function.BlobTrigger",
"shortName": "Blob",
"tags": {
Expand Down Expand Up @@ -46,7 +46,7 @@
"args": {
"referenceType": "package",
"reference": "Microsoft.Azure.Functions.Worker.Extensions.Storage",
"version": "5.1.1-preview2",
"version": "6.0.0",
"projectFileExtensions": ".fsproj"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@ module BlobTriggerFSharp =
[<Function("BlobTriggerFSharp")>]
let run
(
[<BlobTrigger("PathValue/{name}", Connection = "ConnectionValue")>] client: BlobClient,
[<BlobTrigger("PathValue/{name}", Connection = "ConnectionValue")>] client: Stream,
name: string,
context: FunctionContext
) =
let logger
= context.GetLogger "BlobTriggerFSharp"

let text =
client.DownloadContent().Value.Content.ToString()
use blobStreamReader
= new StreamReader(stream)

let blobContent
= blobStreamReader.ReadToEndAsync() |> Async.AwaitTask

let msg =
sprintf "F# Blob trigger function Processed blob\nName: %s \nData: %s" name text
sprintf "Blob content:\nContent: %s" blobContent

logger.LogInformation msg

0 comments on commit daf6b58

Please sign in to comment.