mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 19:19:52 +02:00
feat: utf8
This commit is contained in:
1 parent
63084d1855
commit
2de077a3ab
3 files changed
+19
-6
No files matched your search
@@ -35,6 +35,9 @@ export class ReadStream {
|
||||
ascii(size: number) {
|
||||
return this.buffer.toString('ascii', this.increment(size), this.index);
|
||||
}
|
||||
utf8(size: number) {
|
||||
return this.buffer.toString('utf8', this.increment(size), this.index);
|
||||
}
|
||||
|
||||
int8() {
|
||||
return this.buffer.readInt8(this.increment(1));
|
||||
@@ -94,6 +97,16 @@ export class WriteStream {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
utf8(value: string) {
|
||||
const buffer = Buffer.alloc(Buffer.byteLength(value));
|
||||
|
||||
buffer.write(value, 'utf8');
|
||||
buffer.forEach((value) => {
|
||||
this.array.push(value);
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private uintN(bytes: number, value: number) {
|
||||
for (let index = 0; index < bytes; index++) {
|
||||
|
||||
Reference in new issue
Block a user