@superfunctions/storage-azure 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/adapter.js +8 -0
  2. package/package.json +2 -2
package/dist/adapter.js CHANGED
@@ -282,11 +282,16 @@ export function createAzureStorageAdapter(config) {
282
282
  throw new Error('No readable stream in download response');
283
283
  }
284
284
  const nodeStream = response.readableStreamBody;
285
+ // Pause immediately and only resume in pull() so backpressure from a slow
286
+ // consumer propagates to the source stream instead of buffering the whole
287
+ // object in the ReadableStream's internal queue (memory DoS on large files).
288
+ nodeStream.pause();
285
289
  return new ReadableStream({
286
290
  start(controller) {
287
291
  nodeStream.on('data', (chunk) => {
288
292
  const buffer = typeof chunk === 'string' ? Buffer.from(chunk) : chunk;
289
293
  controller.enqueue(new Uint8Array(buffer));
294
+ nodeStream.pause();
290
295
  });
291
296
  nodeStream.on('end', () => {
292
297
  controller.close();
@@ -295,6 +300,9 @@ export function createAzureStorageAdapter(config) {
295
300
  controller.error(err);
296
301
  });
297
302
  },
303
+ pull() {
304
+ nodeStream.resume();
305
+ },
298
306
  cancel() {
299
307
  if ('destroy' in nodeStream && typeof nodeStream.destroy === 'function') {
300
308
  nodeStream.destroy();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superfunctions/storage-azure",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Azure Blob Storage adapter for @superfunctions/storage",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -30,7 +30,7 @@
30
30
  "publishConfig": { "access": "public" },
31
31
  "dependencies": {
32
32
  "@azure/storage-blob": "^12.18.0",
33
- "@superfunctions/storage": "0.1.0"
33
+ "@superfunctions/storage": "0.2.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "^22.0.0",