Delete nodejs dirty db file

I am having problems deleting a db file using NodeJS Dirty . As far as I can tell, Dirty does not provide a method to delete the db file, so I have to do it manually.

I tried fs.unlink () and it runs correctly, but the file doesn't get deleted until I shutdown the node server, which (I think) means Dirty is still holding the file descriptor. The problem is that I cannot get the file descriptor from Dirty because it uses the createReadStream and createWriteStream methods which do not return file descriptors.

Is it possible to delete the db file generated by Dirty, for example when a client disconnects from the server?

+3


source to share


1 answer


No need to annoy, but why are you trying to annoy him? Maybe there is another way to deal with the problem. Otherwise, the only help I could offer is perhaps using Dirty and providing the ability to kill streams (http://nodejs.org/api/fs.html#fs_fs_createwritestream_path_options)



If you end up going that route please let me know and I'll be happy to help ... I am using DirtyDB for an in-memory database adapter for Sails and Waterline .

+1


source







All Articles