Skip to content

Commit f896ad5

Browse files
committed
feat: added TemplateMemory
1 parent e3c4a7d commit f896ad5

File tree

5 files changed

+675
-14
lines changed

5 files changed

+675
-14
lines changed

src/lib/template/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from "./template-fs.js";
2+
export * from "./template-memory.js";
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
export class MemoryWriteStream {
2+
private chunks: Buffer[] = [];
3+
4+
write(chunk: string | Buffer): boolean {
5+
this.chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, "utf-8"));
6+
return true;
7+
}
8+
9+
end(): void {
10+
// no-op
11+
}
12+
13+
toBuffer(): Buffer {
14+
return Buffer.concat(this.chunks);
15+
}
16+
}

0 commit comments

Comments
 (0)