Skip to content

Commit c6bebf3

Browse files
committed
chore: update devcontainer
1 parent 84f9e6d commit c6bebf3

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
"features": {
99
"ghcr.io/devcontainers/features/azure-cli:1": {},
1010
"ghcr.io/devcontainers/features/github-cli:1": {},
11-
"ghcr.io/azure/azure-dev/azd:latest": {},
12-
"ghcr.io/devcontainers/features/docker-in-docker:2": {
13-
"moby": "false"
14-
}
11+
"ghcr.io/azure/azure-dev/azd:latest": {}
1512
},
1613
// Use 'forwardPorts' to make a list of ports inside the container available locally.
1714
"forwardPorts": [7071, 7072, 4280, 3000],
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions';
2+
import { createWriteStream } from 'fs';
3+
import { Writable } from 'stream';
4+
5+
app.setup({ enableHttpStream: true });
6+
7+
app.http('test', {
8+
methods: ['POST'],
9+
authLevel: 'anonymous',
10+
handler: async function (request: HttpRequest, context: InvocationContext): Promise<HttpResponseInit> {
11+
const writeStream = createWriteStream('test.txt');
12+
await request.body?.pipeTo(Writable.toWeb(writeStream));
13+
14+
for (let i = 0; i < 10; i++) {
15+
context.log(`Processing chunk ${i + 1}/10`);
16+
writeStream.write(`Chunk ${i + 1}\n`);
17+
await new Promise((resolve) => setTimeout(resolve, 500));
18+
}
19+
20+
context.log('Processing complete');
21+
22+
return { body: 'Done!' };
23+
},
24+
});

0 commit comments

Comments
 (0)