REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 2.44 KB
Close
/proc/thread-self/root/home/byroehnu/.trash/node_modules11/pg-protocol/src/buffer-writer.ts
Text
Base64
//binary data writer tuned for encoding binary specific to the postgres binary protocol export class Writer { private buffer: Buffer private offset: number = 5 private headerPosition: number = 0 constructor(private size = 256) { this.buffer = Buffer.allocUnsafe(size) } private ensure(size: number): void { const remaining = this.buffer.length - this.offset if (remaining < size) { const oldBuffer = this.buffer // exponential growth factor of around ~ 1.5 // https://stackoverflow.com/questions/2269063/buffer-growth-strategy const newSize = oldBuffer.length + (oldBuffer.length >> 1) + size this.buffer = Buffer.allocUnsafe(newSize) oldBuffer.copy(this.buffer) } } public addInt32(num: number): Writer { this.ensure(4) this.buffer[this.offset++] = (num >>> 24) & 0xff this.buffer[this.offset++] = (num >>> 16) & 0xff this.buffer[this.offset++] = (num >>> 8) & 0xff this.buffer[this.offset++] = (num >>> 0) & 0xff return this } public addInt16(num: number): Writer { this.ensure(2) this.buffer[this.offset++] = (num >>> 8) & 0xff this.buffer[this.offset++] = (num >>> 0) & 0xff return this } public addCString(string: string): Writer { if (!string) { this.ensure(1) } else { const len = Buffer.byteLength(string) this.ensure(len + 1) // +1 for null terminator this.buffer.write(string, this.offset, 'utf-8') this.offset += len } this.buffer[this.offset++] = 0 // null terminator return this } public addString(string: string = ''): Writer { const len = Buffer.byteLength(string) this.ensure(len) this.buffer.write(string, this.offset) this.offset += len return this } public add(otherBuffer: Buffer): Writer { this.ensure(otherBuffer.length) otherBuffer.copy(this.buffer, this.offset) this.offset += otherBuffer.length return this } private join(code?: number): Buffer { if (code) { this.buffer[this.headerPosition] = code //length is everything in this packet minus the code const length = this.offset - (this.headerPosition + 1) this.buffer.writeInt32BE(length, this.headerPosition + 1) } return this.buffer.slice(code ? 0 : 5, this.offset) } public flush(code?: number): Buffer { const result = this.join(code) this.offset = 5 this.headerPosition = 0 this.buffer = Buffer.allocUnsafe(this.size) return result } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 2 × Files: 9
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
testing
DIR
-
drwxr-xr-x
2026-02-03 15:06:20
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
types
DIR
-
drwxr-xr-x
2026-02-03 15:06:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
b.ts
473 B
lrw-r--r--
2026-02-03 15:06:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
buffer-reader.ts
1.41 KB
lrw-r--r--
2026-02-03 15:06:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
buffer-writer.ts
2.44 KB
lrw-r--r--
2026-02-03 15:06:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
inbound-parser.test.ts
15.04 KB
lrw-r--r--
2026-02-03 15:06:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.ts
443 B
lrw-r--r--
2026-02-03 15:06:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
messages.ts
6.31 KB
lrw-r--r--
2026-02-03 15:06:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
outbound-serializer.test.ts
8.36 KB
lrw-r--r--
2026-02-03 15:06:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
parser.ts
12.69 KB
lrw-r--r--
2026-02-03 15:06:18
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
serializer.ts
7.02 KB
lrw-r--r--
2026-02-03 15:06:20
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).