6989a98d75
- Arkitektur: docs/auth/passwordless-architecture.md - Backend: iom/quixzoom-auth-service/ (FastAPI + Redis) - Webb: quixzoom-market-pages/se/login/ (QR-kod + polling) - App: iom/quixzoom-app/src/features/auth/ (push + deep links) Flöde: QR-kod → app-godkännande → webb-inloggad
34 lines
664 B
JavaScript
34 lines
664 B
JavaScript
'use strict';
|
|
|
|
const { Transform } = require('stream');
|
|
|
|
class LastNewline extends Transform {
|
|
constructor() {
|
|
super();
|
|
this.lastByte = false;
|
|
}
|
|
|
|
_transform(chunk, encoding, done) {
|
|
if (chunk.length) {
|
|
this.lastByte = chunk[chunk.length - 1];
|
|
}
|
|
|
|
this.push(chunk);
|
|
done();
|
|
}
|
|
|
|
_flush(done) {
|
|
if (this.lastByte === 0x0a) {
|
|
return done();
|
|
}
|
|
if (this.lastByte === 0x0d) {
|
|
this.push(Buffer.from('\n'));
|
|
return done();
|
|
}
|
|
this.push(Buffer.from('\r\n'));
|
|
return done();
|
|
}
|
|
}
|
|
|
|
module.exports = LastNewline;
|