question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'offset' parameter in seek and others is "string" but docs use a number

See original GitHub issue

I’m trying to work out the typing of the offset part of the seek call parameter: The documentation at https://kafka.js.org/docs/consuming#a-name-seek-a-seek shows this to be a number, which intuitively makes sense.

But, looking at the code https://github.com/tulios/kafkajs/blob/cef2676e32e773bbb2fbc0ebca51321dd03af70c/src/consumer/consumerGroup.js#L250-L261 it is annotated as string, which seems to go through the code base.

  1. Which is “correct?”
  2. And, of course: If this is a string, should be a string-that-can-be-converted-to-a-number, or is it completely opaque?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ThisIsMissEmcommented, Jul 29, 2019

We could also use javascript’s new BigInt type: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt

It’s currently in stage 3 of ECMAScript specification, which means that it’s being implemented in various javascript engines. It is available for Node.js >= 10

1reaction
JaapRoodcommented, Jul 26, 2019

FYI: in case you might think you will run out of numbers, so need a string, but also what to do offset arithmetic, consider using long. It’s what KafkaJS does to do so and gives all the basic operators you might need.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python File seek() Method - Tutorialspoint
Description. Python file method seek() sets the file's current position at the offset. The whence argument is optional and defaults to 0, ...
Read more >
seek() function? - python - Stack Overflow
A seek() operation moves that pointer to some other part of the file so you can read or write at that place. So,...
Read more >
Python seek() Method - Javatpoint
Parameters: Offset: This is used for defining the number of positions to move forward. from_where: This is used for defining the point of...
Read more >
strpos - Manual - PHP
If the offset is negative, the search will start this number of characters counted from the end of the string.
Read more >
FileStream.Seek(Int64, SeekOrigin) Method (System.IO)
Specifies the beginning, the end, or the current position as a reference point for offset , using a value of type SeekOrigin.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found