search

Home  >  Q&A  >  body text

javascript - What happens when the web side requests a file that is being modified?

I encountered a problem. The web side requested a picture, but the picture was modified dozens of times per second on the server side.
Server-side nodejs uses fs.createReadStream(image_path).pipe(response); to return images.
I tested the python single thread to modify the image 10 times per second.
When the web side requests the image, the request will not be available. Only small data can be requested, and it will not continue to come after continuing to wait. The stream is flowing
I can only try F5 frequently to try my luck
Is there any way to process it in the backend so that the frontend can definitely get this picture?

曾经蜡笔没有小新曾经蜡笔没有小新2780 days ago459

reply all(1)I'll reply

  • 漂亮男人

    漂亮男人2017-05-16 13:36:38

    Don’t use stream if you make frequent modifications. Pictures can be read into the memory using the synchronous method and then passed to the client

    reply
    0
  • Cancelreply