@superfunctions/storage-azure 0.1.0 → 0.2.1
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.
- package/dist/adapter.js +8 -0
- package/package.json +20 -8
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
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Azure Blob Storage adapter for @superfunctions/storage",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,30 +11,42 @@
|
|
|
11
11
|
"default": "./dist/index.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
-
"files": [
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
15
17
|
"scripts": {
|
|
16
18
|
"build": "tsc",
|
|
17
19
|
"test": "vitest",
|
|
18
20
|
"typecheck": "tsc --noEmit",
|
|
19
21
|
"clean": "rm -rf dist"
|
|
20
22
|
},
|
|
21
|
-
"keywords": [
|
|
23
|
+
"keywords": [
|
|
24
|
+
"storage",
|
|
25
|
+
"azure",
|
|
26
|
+
"azure-blob-storage",
|
|
27
|
+
"superfunctions"
|
|
28
|
+
],
|
|
22
29
|
"author": "21n",
|
|
23
30
|
"license": "MIT",
|
|
24
|
-
"bugs": {
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/21nCo/super-functions/issues"
|
|
33
|
+
},
|
|
25
34
|
"repository": {
|
|
26
35
|
"type": "git",
|
|
27
|
-
"url": "git+https://github.com/21nCo/
|
|
36
|
+
"url": "git+https://github.com/21nCo/superfunctions.git",
|
|
28
37
|
"directory": "packages/storage-azure"
|
|
29
38
|
},
|
|
30
|
-
"publishConfig": {
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
31
42
|
"dependencies": {
|
|
32
43
|
"@azure/storage-blob": "^12.18.0",
|
|
33
|
-
"@superfunctions/storage": "0.1
|
|
44
|
+
"@superfunctions/storage": "0.2.1"
|
|
34
45
|
},
|
|
35
46
|
"devDependencies": {
|
|
36
47
|
"@types/node": "^22.0.0",
|
|
37
48
|
"typescript": "^5.6.0",
|
|
38
49
|
"vitest": "^3.2.4"
|
|
39
|
-
}
|
|
50
|
+
},
|
|
51
|
+
"gitHead": "699d9d09932199d660333c57fe7bc646492ea3bf"
|
|
40
52
|
}
|