Skip to content

Commit

Permalink
feat: bump concurrency limits
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwynr committed Nov 18, 2024
1 parent 24b9dd6 commit f1750be
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@filen/sdk",
"version": "0.1.177",
"version": "0.1.178",
"description": "Filen SDK",
"main": "dist/node/index.js",
"browser": "dist/browser/index.js",
Expand Down
10 changes: 8 additions & 2 deletions src/api/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -863,12 +863,18 @@ export class APIClient {
uploadKey
} as unknown as Record<string, string>).toString()

const bufferHash = await bufferToHash({ buffer, algorithm: "sha512" })
const bufferHash = await bufferToHash({
buffer,
algorithm: "sha512"
})
const fullURL = `${
APIClientDefaults.ingestURLs[getRandomArbitrary(0, APIClientDefaults.ingestURLs.length - 1)]
}/v3/upload?${urlParams}&hash=${bufferHash}`
const parsedURLParams = parseURLParams({ url: fullURL })
const urlParamsHash = await bufferToHash({ buffer: Buffer.from(JSON.stringify(parsedURLParams), "utf-8"), algorithm: "sha512" })
const urlParamsHash = await bufferToHash({
buffer: Buffer.from(JSON.stringify(parsedURLParams), "utf-8"),
algorithm: "sha512"
})
const builtHeaders = this.buildHeaders({ apiKey: undefined })

const response = await this.request<UploadChunkResponse>({
Expand Down
12 changes: 6 additions & 6 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ export const CHUNK_SIZE = 1024 * 1024
export const BUFFER_SIZE = 4096
export const BASE64_BUFFER_SIZE = 3 * 1024
export const MAX_CONCURRENT_DOWNLOADS = 16
export const MAX_DOWNLOAD_THREADS = 32
export const MAX_DOWNLOAD_WRITERS = 64
export const MAX_UPLOAD_THREADS = 16
export const MAX_DOWNLOAD_THREADS = 64
export const MAX_DOWNLOAD_WRITERS = 128
export const MAX_UPLOAD_THREADS = 32
export const CURRENT_FILE_ENCRYPTION_VERSION = 2
export const DEFAULT_UPLOAD_REGION = "de-1"
export const DEFAULT_UPLOAD_BUCKET = "filen-1"
export const UPLOAD_CHUNK_SIZE = 1024 * 1024
export const MAX_NOTE_SIZE = 1024 * 1024 - 1
export const MAX_CONCURRENT_LISTING_OPS = 64
export const MAX_CONCURRENT_LISTING_OPS = 128
export const MAX_CONCURRENT_UPLOADS = 16
export const MAX_CONCURRENT_DIRECTORY_UPLOADS = 4
export const MAX_CONCURRENT_DIRECTORY_DOWNLOADS = 4
export const MAX_CONCURRENT_DIRECTORY_UPLOADS = 8
export const MAX_CONCURRENT_DIRECTORY_DOWNLOADS = 8
export const MAX_CHAT_SIZE = 1024 * 64
7 changes: 6 additions & 1 deletion src/crypto/encrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,12 @@ export class Encrypt {
name: "AES-GCM",
iv: this.textEncoder.encode(iv)
},
await importRawKey({ key: Buffer.from(key, "utf-8"), algorithm: "AES-GCM", mode: ["encrypt"], keyCache: false }),
await importRawKey({
key: Buffer.from(key, "utf-8"),
algorithm: "AES-GCM",
mode: ["encrypt"],
keyCache: false
}),
data
)

Expand Down

0 comments on commit f1750be

Please sign in to comment.