Better buffer keyword

I’ve been messing around with the new luau buffer global and i “kinda” found it annoying to used. I’m used to using methods for operations; e.g:

--how it is in studio:
local bfr = buffer.create(1)
buffer.readstring(bfr, 0, buffer.len(bfr))

--what im used too:
local bfr = buffer.create(1)
bfr:read(bfr)

So i made a “quick” module that automatically infers the type you’re trying to assign to make buffers easier to use. e.g:

local buffer = require(*path.to.buffer*)

local value = "Hello World"
local bfr = buffer.create(4)

--// false, since "Hello World" is more than 4 bytes.
if bfr:canStringFitInBuffer(value) then
    
    --// The function infers that it is a string
    --// and calls buffer.writestring
    bfr:write(value)
end

I actually added quite a few functions - here’s all of them:

types
Size: number,
Type: bfrType,
	
write: (self: bfr, value: string | number, forcedType: bfr?) ->  (boolean, string?),
	
canStringFitInBuffer: (self: bfr, str: string) -> boolean,

cani8FitInBuffer: (self: bfr, i8: number) -> boolean,
canu8FitInBuffer: (self: bfr, u8: number) -> boolean,

cani16FitInBuffer: (self: bfr, i16: number) -> boolean,
canu16FitInBuffer: (self: bfr, u16: number) -> boolean,

cani32FitInBuffer: (self: bfr, i32: number) -> boolean,
canu32FitInBuffer: (self: bfr, u32: number) -> boolean,

canf32FitInBuffer: (self: bfr, f32: number) -> boolean,
canf64FitInBuffer: (self: bfr, f64: number) -> boolean,
	
read: (forcedType: bfr?) -> (string, bfrType?),
read_as_string: () -> string

I just made this for quick manipulation of them - I understand that this is limited in some ways but it makes sure that the buffer has enough memory as it infers the type - e.g it knows “8” is a i8, 214 is a u8, etc

I just wanted some feedback on what you think about it, and any other functions I could add. Another example:

local buffer = require(script.buffer)

local value = 32423
local bfr = buffer.create(buffer.getRecommendedBufferSize(value))
--// ^ Get the recomended buffer size from the infered type

print(bfr:write(value)) --// "true" - no errors
print(bfr:read()) --// 32423, u16 (tuple)