Skip to content

Commit

Permalink
update: solve #197
Browse files Browse the repository at this point in the history
  • Loading branch information
clostao committed Dec 11, 2024
1 parent 6d0ccf9 commit a6ed641
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions packages/auto-drive/src/api/wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ const uploadFileChunks = (
export const uploadFileFromInput = (
api: AutoDriveApi,
file: File,
{ password, compression = true }: UploadFileOptions,
options: UploadFileOptions = {},
uploadChunkSize?: number,
): PromisedObservable<UploadFileStatus> => {
const { password = undefined, compression = true } = options
return new PromisedObservable<UploadFileStatus>(async (subscriber) => {
const { stringToCid, compressFile, CompressionAlgorithm, encryptFile, EncryptionAlgorithm } =
await import('@autonomys/auto-dag-data')
Expand Down Expand Up @@ -135,9 +136,11 @@ export const uploadFileFromInput = (
export const uploadFile = (
api: AutoDriveApi,
file: GenericFile,
{ password, compression = true }: UploadFileOptions,
options: UploadFileOptions = {},
uploadChunkSize?: number,
): PromisedObservable<UploadFileStatus> => {
const { password = undefined, compression = true } = options

return new PromisedObservable<UploadFileStatus>(async (subscriber) => {
const { stringToCid, compressFile, CompressionAlgorithm, encryptFile, EncryptionAlgorithm } =
await import('@autonomys/auto-dag-data')
Expand Down
3 changes: 2 additions & 1 deletion packages/auto-drive/src/fs/wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ import { constructZipFromTreeAndFileSystemPaths, getFiles } from './utils.js'
export const uploadFileFromFilepath = (
api: AutoDriveApi,
filePath: string,
{ password, compression = true }: UploadFileOptions,
options: UploadFileOptions = {},
uploadChunkSize?: number,
): PromisedObservable<UploadFileStatus> => {
const { password = undefined, compression = true } = options
const name = filePath.split('/').pop()!

return uploadFile(
Expand Down

0 comments on commit a6ed641

Please sign in to comment.