web: add support for backup/restore of attachments

This commit is contained in:
Abdullah Atta
2024-07-26 12:47:50 +05:00
committed by Abdullah Atta
parent 341032c884
commit 10e24ae632
2 changed files with 117 additions and 23 deletions

View File

@@ -52,14 +52,14 @@ import {
import { logger } from "../utils/logger";
import { newQueue } from "@henrygd/queue";
const ABYTES = 17;
export const ABYTES = 17;
const CHUNK_SIZE = 512 * 1024;
const ENCRYPTED_CHUNK_SIZE = CHUNK_SIZE + ABYTES;
const UPLOAD_PART_REQUIRED_CHUNKS = Math.ceil(
(10 * 1024 * 1024) / ENCRYPTED_CHUNK_SIZE
);
const MINIMUM_MULTIPART_FILE_SIZE = 25 * 1024 * 1024;
const streamablefs = new StreamableFS(
export const streamablefs = new StreamableFS(
isFeatureSupported("opfs")
? new OriginPrivateFileSystem("streamable-fs")
: isFeatureSupported("cache")
@@ -665,7 +665,8 @@ export const FileStorage: IFileStorage = {
deleteFile,
exists,
clearFileStorage,
hashBase64
hashBase64,
getUploadedFileSize
};
function isSuccessStatusCode(statusCode: number) {