'offset' parameter in seek and others is "string" but docs use a number
See original GitHub issueI’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.
- Which is “correct?”
- 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:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
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.