@basaltkit/storage-azure 1.0.1 → 1.1.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.
- package/dist/index.d.ts +3 -2
- package/dist/index.js +8 -4
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PutOptions, type StorageDriver } from '@basaltkit/storage';
|
|
1
|
+
import { type TemporaryUrlOptions, type PutOptions, type StorageDriver } from '@basaltkit/storage';
|
|
2
2
|
/** The subset of an `@azure/storage-blob` BlockBlobClient this driver uses. */
|
|
3
3
|
export interface AzureBlobLike {
|
|
4
4
|
uploadData(data: Buffer, options?: {
|
|
@@ -14,6 +14,7 @@ export interface AzureBlobLike {
|
|
|
14
14
|
generateSasUrl(options: {
|
|
15
15
|
permissions: string;
|
|
16
16
|
expiresOn: Date;
|
|
17
|
+
contentDisposition?: string;
|
|
17
18
|
}): Promise<string>;
|
|
18
19
|
}
|
|
19
20
|
/** The subset of an `@azure/storage-blob` ContainerClient this driver uses. */
|
|
@@ -46,7 +47,7 @@ export declare class AzureBlobStorageDriver implements StorageDriver {
|
|
|
46
47
|
exists(path: string): Promise<boolean>;
|
|
47
48
|
delete(path: string): Promise<boolean>;
|
|
48
49
|
list(prefix: string): Promise<string[]>;
|
|
49
|
-
temporaryUrl(path: string, expiresInMs: number): Promise<string>;
|
|
50
|
+
temporaryUrl(path: string, expiresInMs: number, options?: TemporaryUrlOptions): Promise<string>;
|
|
50
51
|
disconnect(): Promise<void>;
|
|
51
52
|
private container;
|
|
52
53
|
}
|
package/dist/index.js
CHANGED
|
@@ -42,10 +42,14 @@ export class AzureBlobStorageDriver {
|
|
|
42
42
|
names.push(blob.name);
|
|
43
43
|
return names;
|
|
44
44
|
}
|
|
45
|
-
async temporaryUrl(path, expiresInMs) {
|
|
46
|
-
return (await this.container())
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
async temporaryUrl(path, expiresInMs, options) {
|
|
46
|
+
return (await this.container()).getBlockBlobClient(path).generateSasUrl({
|
|
47
|
+
permissions: 'r',
|
|
48
|
+
expiresOn: new Date(Date.now() + expiresInMs),
|
|
49
|
+
// SAS-pinned response header: uploaded HTML/SVG downloads instead of
|
|
50
|
+
// rendering on the storage origin ('attachment' is the Disk default).
|
|
51
|
+
contentDisposition: options?.disposition ?? 'attachment',
|
|
52
|
+
});
|
|
49
53
|
}
|
|
50
54
|
async disconnect() { }
|
|
51
55
|
container() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basaltkit/storage-azure",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Azure Blob Storage driver for @basaltkit/storage — put/get/list/delete/SAS URLs over @azure/storage-blob, with an injectable client for testing.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dist"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@basaltkit/storage": "^1.
|
|
17
|
+
"@basaltkit/storage": "^1.3.0"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@azure/storage-blob": "^12.0.0"
|