fseek method
Sets the file position of the stream to the given offset.
Implementation
int fseek(FILE stream, int offset, int whence) {
try {
int newPos;
if (whence == SEEK_SET) {
newPos = offset;
} else if (whence == SEEK_CUR) {
newPos = stream._raf.positionSync() + offset;
} else if (whence == SEEK_END) {
newPos = stream._raf.lengthSync() + offset;
} else {
return -1;
}
stream._raf.setPositionSync(newPos);
stream._isEOF = false;
return 0;
} catch (e) {
return -1;
}
}