2020-09-16 20:07:28 +08:00
|
|
|
import { EventEmitter } from 'events'
|
|
|
|
|
|
|
|
|
2023-10-25 18:45:16 +08:00
|
|
|
export class OctetParser extends EventEmitter {
|
|
|
|
write(buffer) {
|
2020-09-16 20:07:28 +08:00
|
|
|
this.emit('data', buffer)
|
|
|
|
return buffer.length
|
|
|
|
}
|
|
|
|
|
2023-10-25 18:45:16 +08:00
|
|
|
end () {
|
2020-09-16 20:07:28 +08:00
|
|
|
this.emit('end')
|
|
|
|
}
|
2023-10-25 18:45:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|