Return an actual stream from a session query

#1

Does OrientJS support returning an actual readable stream from a session query? For example, to take the entire query result and pipe it to a local file (or other writable-stream-supporting destination)? If so, is there an example of what that would look like?

PS - Ideally, I’m looking for a way to do this using await session.query().

#2

Hi,
what version are you using?

Thanks
Regards,
Michela

#3

OrientJS 3.0.5 with ODB 3.0.18

#4

Hi @eric24

yes the result of session.query is an extension readable stream so you can pipe it with writable stream.

await it is supported with the extension .all()
session.query(...).all() which consume the stream and collect the results into an array.

For an example of piping into a file check this example

Let me know if this helps

Thanks

#5

Excellent! Let me play around with that a bit.