Node:Seeking, Next:, Previous:Peeking, Up:Usage



Seeking

Sometimes, you need to reposition within your stream. To do this, you use the seek(position, [offset]) method. position is the new position in the stream, counted byte-wise and starting at 0. The optional argument offset specifies from where the method should seek. If it is Set, counting is started at the beginning of the stream. Add indicates to seek from the current stream position and End means seeking from the end of the stream. Note that position is a signed integer value and you can also seek backwards by inserting a negative number.

You can use the pos() method to determine your current position within the stream, which is returned by the method.