If you guys has to know what I am actually doing, then this is it: https://github.com/Meigyoku-Thmn/CSBinary (A port of BinaryReader and BinaryWriter from .NET Core).The thing is, my library doesn't have File Buffering (please, again from my other post, this has nothing to do with the Buffer class in NodeJS), and I want to take advantage of the I/O system of the C runtime, instead of having to write a BufferedFile class (think of the BufferedStream class in .NET).In C language, if you open/create a file (fopen) and get a FILE\* instance, then it's doing file buffering behind the scene, you can even set the file buffer size (again, nothing to do with the Buffer class) by using the setvbuf function.And I think if I have a file descriptor in hand (created by fs module), I could use the fdopen function to wrap it/associate it in a FILE* instance, and get the built-in C runtime's file buffering for free.Unfortunately, NodeJS seems to be built using static link. So my addon uses seperate C runtime from the one that NodeJS uses. File descriptor created from NodeJS cannot be used directly in my addon, and libuv doesn't have anything similiar to fdopen.According to this section in NodeJS docs, there is a case that node-gyp will "download the full source tarball" and let me "have complete access to the full set of Node.js dependencies". That may be the way, but aside from specifying the nodedir flag (which requires me to manually prepare "a local Node.js source image"), the docs is pretty vague.So is this the dead end, anybody has experience about this, please help me.
Submitted August 14, 2020 at 04:38PM by MeigyokuThmn
No comments:
Post a Comment