Skip to content

🎥 Make videos programmatically with React

awesome

Jonny Burger8bd1d80aa67a
diff --git a/packages/serverless/src/stream-to-string.ts b/packages/serverless/src/stream-to-string.ts
index a755f81682..ac558d7ae8 100644
--- a/packages/serverless/src/stream-to-string.ts
+++ b/packages/serverless/src/stream-to-string.ts
@@ -5,9 +5,9 @@ export function streamToString(stream: Readable | Buffer) {
return stream.toString('utf-8');
}
- const chunks: Buffer[] = [];
+ const chunks: Uint8Array[] = [];
return new Promise<string>((resolve, reject) => {
- stream.on('data', (chunk) => chunks.push(Buffer.from(chunk)));
+ stream.on('data', (chunk) => chunks.push(chunk));
stream.on('error', (err) => reject(err));
stream.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')));
});
diff --git a/packages/serverless/src/streaming/response-stream.ts b/packages/serverless/src/streaming/response-stream.ts
index 040ebfed2a..dd0757447c 100644
--- a/packages/serverless/src/streaming/response-stream.ts
+++ b/packages/serverless/src/streaming/response-stream.ts
@@ -8,7 +8,7 @@ type Chunk = {
export class ResponseStream extends Writable {
private queue: Chunk[] = [];
private waitingResolve: ((value?: Chunk) => void)[] = [];
- private response: Buffer[];
+ private response: Uint8Array[];
constructor() {
super();
@@ -28,7 +28,7 @@ export class ResponseStream extends Writable {
this.queue.push({PayloadChunk: {Payload: data}, InvokeComplete: false});
}
- this.response.push(Buffer.from(chunk, encoding));
+ this.response.push(new Uint8Array(Buffer.from(chunk, encoding)));
callback();
}
@@ -43,7 +43,7 @@ export class ResponseStream extends Writable {
}
getBufferedData(): Buffer {
- return Buffer.concat(this.response);
+ return Buffer.concat(this.response as Uint8Array[]);
}
async *[Symbol.asyncIterator](): AsyncGenerator<Chunk, void, void> {
diff --git a/packages/serverless/src/streaming/streaming.ts b/packages/serverless/src/streaming/streaming.ts
index d684731360..8c3d69dfce 100644
--- a/packages/serverless/src/streaming/streaming.ts
+++ b/packages/serverless/src/streaming/streaming.ts
@@ -138,7 +138,7 @@ export const makeStreamPayload = <Provider extends CloudProvider>({
const body =
formatMap[message.type] === 'json'
? new TextEncoder().encode(JSON.stringify(message.payload))
- : (message.payload as Buffer);
+ : new Uint8Array(message.payload as Buffer);
return makeStreamPayloadMessage({
body,
diff --git a/packages/studio-server/src/ansi-diff.ts b/packages/studio-server/src/ansi-diff.ts
index 1f50ba13f1..da30d7ef60 100644
--- a/packages/studio-server/src/ansi-diff.ts
+++ b/packages/studio-server/src/ansi-diff.ts
@@ -116,7 +116,7 @@ export class AnsiDiff {
this._moveTo(last.remainder, last.y + last.height);
}
- return Buffer.concat(this._out as Uint8Array[]);
+ return Buffer.concat(this._out);
}
_clearDown(y: number) {