template-saas/apps/backend/node_modules/@tokenizer/inflate/lib/GzipHandler.js
rckrdmrd 26f0e52ca7 feat: Initial commit - template-saas
Template base para proyectos SaaS multi-tenant.

Estructura inicial:
- apps/backend (NestJS API)
- apps/frontend (React/Vite)
- apps/database (PostgreSQL DDL)
- docs/ (Documentación)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 04:41:24 -06:00

20 lines
629 B
JavaScript

export class GzipHandler {
constructor(tokenizer) {
this.tokenizer = tokenizer;
}
inflate() {
const tokenizer = this.tokenizer;
return new ReadableStream({
async pull(controller) {
const buffer = new Uint8Array(1024);
const size = await tokenizer.readBuffer(buffer, { mayBeLess: true });
if (size === 0) {
controller.close();
return;
}
controller.enqueue(buffer.subarray(0, size));
}
}).pipeThrough(new DecompressionStream("gzip"));
}
}