You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
There is an existing method which could fairly easily be adjusted to add optional arguments for the offset and the amount of data. I think this would be the simplest approach. Do you think that might address your request adequately?
Yup, I think that that would fit my request!
It wouldn't help as much as the seek functionality would for resuming a download, but for my particular use-case it should work fine!
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 withDBMS_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 usingnode:stream/consumers
and it is already a stream.OS: Win + WSL2(ubuntu 22.04.2)
nodejs: v18
node-oracledb: v6.3
The text was updated successfully, but these errors were encountered: