Skip to content

Commit ee61727

Browse files
committed
Always return array from readBuffers
1 parent 2ca9d91 commit ee61727

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

demo/node/file_proxy.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,8 @@ class FileProxyPromise extends FileProxy {
9292
/** Class supporting multi-range requests */
9393
class FileProxyMultiple extends FileProxyPromise {
9494

95-
/** example of reading several segments at once */
95+
/** example of reading several segments at once, always return array */
9696
async readBuffers(places) {
97-
if (places.length === 2)
98-
return this.readBuffer(places[0], places[1]);
99-
10097
if (!this.fd)
10198
return Promise.resolve([]);
10299

modules/io.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3903,7 +3903,9 @@ class TProxyFile extends TFile {
39033903
return Promise.reject(Error(`File is not opened ${this.fFileName}`));
39043904

39053905
if (isFunc(this.proxy.readBuffers))
3906-
return this.proxy.readBuffers(place);
3906+
return this.proxy.readBuffers(place).then(arr => {
3907+
return arr?.length === 1 ? arr[0] : arr;
3908+
});
39073909

39083910
if (place.length === 2)
39093911
return this.proxy.readBuffer(place[0], place[1]);

0 commit comments

Comments
 (0)