# Asynchronous file io in a module

**URL:** <https://www.ruby-forum.com/t/asynchronous-file-io-in-a-module/187101>\
**Category:** NGINX\
**Created:** [April 17, 2010, 12:30am UTC](https://www.ruby-forum.com/t/asynchronous-file-io-in-a-module/187101 "2010-04-17T00:30:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wombat57](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/aeb1de/32.png) [@wombat57](https://www.ruby-forum.com/u/wombat57)\
**Post date:** [April 17, 2010, 12:30am UTC](https://www.ruby-forum.com/t/asynchronous-file-io-in-a-module/187101/1 "2010-04-17T00:30:49Z")

</div>

I am trying to modify the flv streaming module to support h.246 and aac  
flv files. All that the module has to do is find the aac and h246  
sequence headers in the beginning of the file, and copy these into the  
output buffer before the body of the file. This is not particularly  
hard, and I have it working with blocking io. What is the proper way to  
do this within nginx using asynchronous io? Reading Emiller’s Guide To  
Nginx Module Development  
([Emiller’s Guide to Nginx Module Development – Evan Miller](http://www.evanmiller.org/nginx-modules-guide.html)), I see that I could  
do an upstream proxy request to self, but that seems unnecessarily  
convoluted. Is there a simpler, high performance way to access the  
actual file data without blocking the process?

Thanks

-AB

Posted at Nginx Forum:

> **[asynchronous file io in a module](https://forum.nginx.org/read.php?2,75922,75922#msg-75922)**
>
> I am trying to modify the flv streaming module to support h.246 and aac flv files. All that the module has to do is find the aac and h246 sequence headers in the beginning of the file, and copy these into the output buffer before the body of the...
