Skip to content

Unable to encode uint64 #23

@sabahath786

Description

@sabahath786

var ipHeader = new Parser()
.uint16("fragment_id")
.uint16("fragment_total")
.uint64("date_time")

var anIpHeader = {
fragment_id: 1,
fragment_total: 1,
datetime: 4744430483355899789,
}

console.log(ipHeader.encode(anIpHeader).toString("hex"));

I am getting error:

internal/buffer.js:598
let lo = Number(value & 0xffffffffn);
^

TypeError: Cannot mix BigInt and other types, use explicit conversions
at writeBigU_Int64BE (internal/buffer.js:598:25)
at Buffer.writeBigUInt64BE (internal/buffer.js:618:10)
at SmartBuffer._writeNumberValue (C:\work\ugves\project\repo-poc\emulator-prs-poc\nodejs-es-to-prs\node-start-es6\node_modules\smart-buffer\src\smartbuffer.ts:1402:10)
at SmartBuffer.writeBigUInt64BE (C:\work\ugves\project\repo-poc\emulator-prs-poc\nodejs-es-to-prs\node-start-es6\node_modules\smart-buffer\src\smartbuffer.ts:576:17)
at Parser.compiledEncode (evalmachine.:11:13)

Please help me how can i fix this issue

appreciate quick support,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions