We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 79255f0 commit 3a01a94Copy full SHA for 3a01a94
src/utils/hub.js
@@ -80,13 +80,15 @@ class FileResponse {
80
81
this.updateContentType();
82
83
- let self = this;
+ const stream = fs.createReadStream(filePath);
84
this.body = new ReadableStream({
85
start(controller) {
86
- self.arrayBuffer().then(buffer => {
87
- controller.enqueue(new Uint8Array(buffer));
88
- controller.close();
89
- })
+ stream.on('data', (chunk) => controller.enqueue(chunk));
+ stream.on('end', () => controller.close());
+ stream.on('error', (err) => controller.error(err));
+ },
90
+ cancel() {
91
+ stream.destroy();
92
}
93
});
94
} else {
0 commit comments