0.1.8 • Published 4 years ago

buffer-op v0.1.8

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

buffer-op

a toolset of how to handle buffer

example

let lib = require("buffer-op")

let stream = new lib.Stream(64)
let writer = new lib.Writer(stream)
let reader = new lib.Reader(stream)

{
    writer.append_int8(-10)
    writer.append_uint8(10)
    writer.append_int32(-1000)
    writer.append_uint32(1000)
    writer.append_string("this is a test")
    writer.append_double(10.4)
}

{
    let another = new lib.Stream()
    let another_writer = new lib.Writer(another)

    for (let i = 0, len = 20; i < len; ++i)
    {
        another_writer.append_string("this is gonna be a huge thing")
        another_writer.append_int32(-323)
    }

    writer.append_bytes(another)
}

{
    console.log(reader.read_int8())
    console.log(reader.read_uint8())

    console.log(reader.read_int32())
    console.log(reader.read_uint32())

    console.log(reader.read_string())
    console.log(reader.read_double())
}

{
    console.log("----------------------------")

    let buffer = reader.read_bytes()
    let another = new lib.Stream(buffer)
    let another_reader = new lib.Reader(another)

    for (let i = 0, len = 20; i < len; ++i)
    {
        console.log(another_reader.read_string())
        console.log(another_reader.read_int32())
    }

    console.log(another_reader.left_size())
}
0.1.8

4 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago