mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-09-17 09:06:48 +07:00
67ce3558d6
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
33 lines
950 B
JavaScript
33 lines
950 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const node_stream_1 = require("node:stream");
|
|
class LastNewline extends node_stream_1.Transform {
|
|
constructor() {
|
|
super();
|
|
this.lastByte = false;
|
|
}
|
|
/** @internal */
|
|
_transform(chunk, encoding, done) {
|
|
if (chunk.length) {
|
|
this.lastByte = chunk[chunk.length - 1];
|
|
}
|
|
this.push(chunk);
|
|
done();
|
|
}
|
|
/** @internal */
|
|
_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();
|
|
}
|
|
}
|
|
exports.default = LastNewline;
|
|
module.exports = exports.default;
|
|
Object.defineProperty(module.exports, 'default', { value: exports.default, enumerable: false, writable: true, configurable: true });
|