-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
- Describe your new request in detail
I'm looking for a way to pull a set of bytes from a BLOB for downloading/streaming a file out of the database. Currently there doesn't appear to be any way to start the read stream from an offset or read a set of bytes from an offset (if you want to read more than a RAW buffer allows with DBMS_LOB.SUBSTR). The only approach I can find currently from the node side, would be to stream through the entire BLOB until the correct offset is reached, then stream the small piece I want and end the stream there - which seems entirely wasteful to me. And from the OracleDB side, the best answer I've seen so far on Stack Overflow was pulling out individual 2kb segments as raw buffers and then putting them together on the client-side, which is rather a lot of individual segments if you want a MB of data.
There appears to be prior art in the Python Oracledb package (LOB.Read()) and in the .net package (Blob.seek())
Either of these two functions would be suitable for my purposes, with the .seek() approach probably being the more versatile of the two since you can convert a read-stream to a buffer using node:stream/consumers and it is already a stream.
- Give supporting information about tools and operating systems. Give relevant product version numbers
OS: Win + WSL2(ubuntu 22.04.2)
nodejs: v18
node-oracledb: v6.3