-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is required to be able to handle streams in _dbop()? #13
Comments
Hi, |
As time allows, I might take a crack at hacking in a solution to get streaming TO BaseX working as that would be a big help for my current use case. I can finish my project without it but it would be a bit of a performance boost to stream directly to the db without saving an intermediate file. |
merged some time ago |
Hello,
First off thanks for creating these node bindings for BaseX. I think it is going to be a big help on my current project.
I'm building a web api that receives xml files in a post request and adds them to my BaseX db. Currently I am writing the received file to disk then opening it and passing it as string data to the Session.add() method.
It would be nice if I could stream the data directly to add() without having to hit the disk. I have access to the incoming readStream but it looks like stream support has not been added in _dbop().
Did you have a solution for this in mind? If you could give me an overview perhaps I could help implement it.
It looks like the action hinges around line 320 of index.js in sendQueueItem():
and in this.send() line 144:
so it seems like we would need to modify _dbop() to check if the input is a string or a stream and if it is a stream, instead of passing the command as a string like so (line 219 this._dbop()):
add a reference to the stream and other command components to the command object and make send a reference to a function that will read the stream:
and then this.readStream() could read the input stream and then return the assembled command in the format:
I'm still a relative beginner with node so I might be a bit off on my proposed solution and would appreciate any feedback or let me know what you were thinking for a solution.
Best,
-Jesse
The text was updated successfully, but these errors were encountered: