At first I want to mention that I'm asking about JS in browser, not Node.js.
I read file (image) from file input (<input type="file" />) and I need to draw it on canvas and do some low level operations on it. There's no problem and everything works fine if image is already in memory when I run an operation but if I'm reading it like I wrote before (from user's fs via input) I don't know when to run the operation. If I start it immediately then framebuffer is incomplete*.
Due to other parts of system I don't read image bit by bit. Instead I create img tag with src attribute set to URL created via URL.createObjectURL with the file object passed to it and then draw that image on canvas. I'd prefer not to change that because this is gonna be pretty big change.
*It's an error from library glfx.js if it gonna help.