triangle-utils 1.4.152 → 1.4.154

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.
@@ -71,7 +71,9 @@ export declare class UtilsS3 {
71
71
  part_size?: number;
72
72
  }): Promise<void>;
73
73
  delete(s3_id: string): Promise<void>;
74
- get_download_url(s3_id: string): Promise<string | undefined>;
74
+ get_download_url(s3_id: string, options?: {
75
+ name?: string;
76
+ }): Promise<string | undefined>;
75
77
  get_upload_url(s3_id: string, options?: {
76
78
  content_type_id?: string;
77
79
  }): Promise<string | undefined>;
@@ -175,7 +175,8 @@ export class UtilsS3 {
175
175
  }
176
176
  await this.s3.deleteObject(s3_input);
177
177
  }
178
- async get_download_url(s3_id) {
178
+ async get_download_url(s3_id, options = {}) {
179
+ const name = options.name || undefined;
179
180
  const headers = await this.get_headers(s3_id);
180
181
  if (headers === undefined) {
181
182
  return undefined;
@@ -184,7 +185,10 @@ export class UtilsS3 {
184
185
  if (s3_input === undefined) {
185
186
  return undefined;
186
187
  }
187
- const command = new GetObjectCommand(s3_input);
188
+ const command = new GetObjectCommand({
189
+ ...s3_input,
190
+ ResponseContentDisposition: name !== undefined ? ("filename = \"" + name + "\"") : undefined
191
+ });
188
192
  const url = await getSignedUrl(this.s3, command);
189
193
  return url;
190
194
  }
package/dist/src/f.js CHANGED
@@ -81,3 +81,5 @@ const utils = new TriangleUtils(config);
81
81
  // .then(user => console.log(user))
82
82
  // await utils.bedrock.cohere_invoke("cohere.embed-v4", "yyyyyuuuuuurrrrr")
83
83
  // .then(response => console.log(response))
84
+ await utils.s3.get_download_url("s3://triangle-675045717295-us-east-1-an/tenant_documents/a3a9627f-a94d-4d47-a110-307a6f5563af/a146d789-da40-4e3c-a132-8b7110f3f7df.pdf", { name: "hye.pdf" })
85
+ .then(response => console.log(response));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-utils",
3
- "version": "1.4.152",
3
+ "version": "1.4.154",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
package/src/UtilsS3.ts CHANGED
@@ -196,7 +196,8 @@ export class UtilsS3 {
196
196
  await this.s3.deleteObject(s3_input)
197
197
  }
198
198
 
199
- async get_download_url(s3_id : string) : Promise<string | undefined> {
199
+ async get_download_url(s3_id : string, options : { name? : string } = {}) : Promise<string | undefined> {
200
+ const name = options.name || undefined
200
201
  const headers = await this.get_headers(s3_id)
201
202
  if (headers === undefined) {
202
203
  return undefined
@@ -205,7 +206,10 @@ export class UtilsS3 {
205
206
  if (s3_input === undefined) {
206
207
  return undefined
207
208
  }
208
- const command = new GetObjectCommand(s3_input)
209
+ const command = new GetObjectCommand({
210
+ ...s3_input,
211
+ ResponseContentDisposition: name !== undefined ? ("filename = \"" + name + "\"") : undefined
212
+ })
209
213
  const url = await getSignedUrl(this.s3, command)
210
214
  return url
211
215
  }
package/src/f.ts CHANGED
@@ -101,4 +101,7 @@ const utils = new TriangleUtils(config)
101
101
  // .then(user => console.log(user))
102
102
 
103
103
  // await utils.bedrock.cohere_invoke("cohere.embed-v4", "yyyyyuuuuuurrrrr")
104
- // .then(response => console.log(response))
104
+ // .then(response => console.log(response))
105
+
106
+ await utils.s3.get_download_url("s3://triangle-675045717295-us-east-1-an/tenant_documents/a3a9627f-a94d-4d47-a110-307a6f5563af/a146d789-da40-4e3c-a132-8b7110f3f7df.pdf", { name : "hye.pdf" })
107
+ .then(response => console.log(response))