Impatient divisibility test
JavaScript (ES6), 70 bytes

Input format: Curried function

A function that takes the divisor and returns a function that takes each digit or \$-1\$ for EOF. The second function returns either \$0\$ (false), \$1\$ (true) or itself (no answer).



p=&gt;(q='',g=(d,t=k=z=!~d||(q=d+q,p))=&gt;k--?g(d,t-=(k+q)%p&lt;1):t?t-z&amp;&amp;g:1)


Try it online!

How?

Given a divisor \$p\$ and a dividend \$q\$ consisting of \$n\$ decimal digits, we compute the following expression for all \$0 \le k &lt; p\$:

$$k\times 10^n+q \pmod p\tag{1}$$

For any \$x\ge p\$ there exists \$m\ge 1\$ and \$0 \le k &lt; p\$ such that \$x=mp+k\$, leading to:

$$x\times 10^n+q \pmod p=\\
(mp+k)\times 10^n+q \pmod p=\\
(mp\times 10^n \pmod p)+ (k\times 10^n+q \pmod p)\pmod p=\\
0+(k\times 10^n+q \pmod p)\pmod p=\\
k\times 10^n+q \pmod p$$

Therefore, if \$(1)\$ is equal to \$0\$ for all \$0 \le k &lt; p\$, it will also be equal to \$0\$ for any \$k \ge p\$ and the answer is true.

For the same reason, if \$(1)\$ is greater than \$0\$ for all \$0 \le k &lt; p\$, the answer is false.

If the results of \$(1)\$ are mixed, we can't decide yet and need either more digits of \$q\$ or the EOF notification.

Commented

p =&gt; (                       // p = divisor
  q = '',                    // q = dividend stored as a string, initially empty
  g = (                      // g() = curried function taking:
    d,                       //   d = next digit
    t =                      //   t = number of iterations yielding a non-zero value
    k =                      //   k = total number of iterations to process
    z =                      //   z = copy of k
      !~d ||                 //   if d == -1 (meaning EOF), use only 1 iteration
                             //   so that we simply test the current value of q
      (q = d + q, p)         //   otherwise, prepend d to q and use p iterations
  ) =&gt;                       //
    k-- ?                    //   decrement k; if it was not equal to zero:
      g(                     //     do a recursive call to g():
        d,                   //       pass the current value of d (will be ignored anyway)
        t -= (k + q) % p &lt; 1 //       test (k + q) % p and update t accordingly
      )                      //     end of recursive call
    :                        //   else:
      t ?                    //     if t is greater than 0:
        t - z &amp;&amp; g           //       return 0 if t == z, or g otherwise
      :                      //     else:
        1                    //       return 1
)                            //