@vryzel/file-next 0.4.5 → 0.5.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/{filesystem-CewcaWEl.d.cts → filesystem-C0vVDtg4.d.cts} +6 -0
- package/dist/{filesystem-B0bJh8bW.d.ts → filesystem-Djiiu6YU.d.ts} +6 -0
- package/dist/index.cjs +16 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/dist/server/index.cjs +15 -5
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +2 -2
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +15 -5
- package/dist/server/index.js.map +1 -1
- package/dist/sync/index.cjs +30 -2
- package/dist/sync/index.cjs.map +1 -1
- package/dist/sync/index.d.cts +1 -1
- package/dist/sync/index.d.ts +1 -1
- package/dist/sync/index.js +30 -2
- package/dist/sync/index.js.map +1 -1
- package/dist/{with-auth-DDTngJoQ.d.cts → with-auth-Dtn57B_S.d.cts} +1 -1
- package/dist/{with-auth-f82V2WB6.d.ts → with-auth-OZNiZGga.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -210,6 +210,12 @@ interface PresignedUploadInput {
|
|
|
210
210
|
interface PresignedDownloadInput {
|
|
211
211
|
key: S3Key;
|
|
212
212
|
expiresIn?: number;
|
|
213
|
+
/**
|
|
214
|
+
* Default `attachment`. `inline` is honored only for non-executing preview types.
|
|
215
|
+
* Pass `contentType` or the signer keeps `attachment`.
|
|
216
|
+
*/
|
|
217
|
+
disposition?: "attachment" | "inline";
|
|
218
|
+
contentType?: string;
|
|
213
219
|
}
|
|
214
220
|
interface GetPublicUrlInput {
|
|
215
221
|
key: S3Key;
|
|
@@ -210,6 +210,12 @@ interface PresignedUploadInput {
|
|
|
210
210
|
interface PresignedDownloadInput {
|
|
211
211
|
key: S3Key;
|
|
212
212
|
expiresIn?: number;
|
|
213
|
+
/**
|
|
214
|
+
* Default `attachment`. `inline` is honored only for non-executing preview types.
|
|
215
|
+
* Pass `contentType` or the signer keeps `attachment`.
|
|
216
|
+
*/
|
|
217
|
+
disposition?: "attachment" | "inline";
|
|
218
|
+
contentType?: string;
|
|
213
219
|
}
|
|
214
220
|
interface GetPublicUrlInput {
|
|
215
221
|
key: S3Key;
|
package/dist/index.cjs
CHANGED
|
@@ -3061,6 +3061,20 @@ var setMetadata = async (client, config, input) => {
|
|
|
3061
3061
|
return err(fromAws(e));
|
|
3062
3062
|
}
|
|
3063
3063
|
};
|
|
3064
|
+
|
|
3065
|
+
// src/storage/content-disposition.ts
|
|
3066
|
+
var NEVER_INLINE = /* @__PURE__ */ new Set(["text/html", "application/xhtml+xml", "image/svg+xml"]);
|
|
3067
|
+
function signedContentDisposition(requested, contentType) {
|
|
3068
|
+
if (requested !== "inline") return "attachment";
|
|
3069
|
+
const mime = (contentType ?? "").split(";")[0]?.trim().toLowerCase() ?? "";
|
|
3070
|
+
if (!mime || NEVER_INLINE.has(mime)) return "attachment";
|
|
3071
|
+
if (mime === "application/pdf" || mime === "text/plain" || mime === "text/csv" || mime === "text/markdown" || mime.startsWith("image/") || mime.startsWith("video/") || mime.startsWith("audio/")) {
|
|
3072
|
+
return "inline";
|
|
3073
|
+
}
|
|
3074
|
+
return "attachment";
|
|
3075
|
+
}
|
|
3076
|
+
|
|
3077
|
+
// src/storage/s3-adapter/presigned.ts
|
|
3064
3078
|
var createPresignedUploadUrl = async (client, config, input) => {
|
|
3065
3079
|
try {
|
|
3066
3080
|
const cmd = new clientS3.PutObjectCommand({
|
|
@@ -3078,7 +3092,8 @@ var createPresignedDownloadUrl = async (client, config, input) => {
|
|
|
3078
3092
|
try {
|
|
3079
3093
|
const cmd = new clientS3.GetObjectCommand({
|
|
3080
3094
|
Bucket: config.bucket,
|
|
3081
|
-
Key: input.key
|
|
3095
|
+
Key: input.key,
|
|
3096
|
+
ResponseContentDisposition: signedContentDisposition(input.disposition, input.contentType)
|
|
3082
3097
|
});
|
|
3083
3098
|
const url = await s3RequestPresigner.getSignedUrl(client, cmd, { expiresIn: input.expiresIn ?? 900 });
|
|
3084
3099
|
return ok({ url });
|