Node.js addon: File I / O via Node.js FileSystem module from C ++ side

I am working on a linear algebra Node.js addon (written in C ++) and I want to be able to save and read from disk all the objects that I have exposed.

For example, it v = la.load(fs.open("vector.out", "r-"));

will load the vector object that I previously saved with v.save(fs.open("vector.out", "r+"));

. (I do this - I want the user to pass in a Node.js object for file I / O and use that object to load / save my object.)

My question (s):

  • How do I access Node.js objects FileSystem

    from the C ++ side? (On the Javascript side, the user is passing an object to fs

    my function load

    , and I want to extract a file descriptor from that object.)
  • How do Node.js addons usually solve this? Any advice?
+3


source to share





All Articles