File tree Expand file tree Collapse file tree
src/releaseUploader/ipfsNode Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,31 +43,14 @@ export async function ipfsAddFromFs(
4343 ] ;
4444 }
4545
46- // Track progress
47- let totalSize = 0 ;
48- let uploadedSize = 0 ;
49- for ( const file of files ) {
50- const filePath = path . resolve ( dirOrFilePath , file . path ) ;
51- if ( fs . existsSync ( filePath ) ) {
52- const stat = fs . statSync ( filePath ) ;
53- totalSize += stat . size ;
54- } else {
55- // Optionally log or handle missing files
56- continue ;
57- }
58- }
59-
6046 // Add files to IPFS
6147 let lastCid = "" ;
6248 for await ( const result of kuboClient . addAll ( files , {
63- wrapWithDirectory : true
49+ wrapWithDirectory : true ,
50+ progress : onProgress
6451 } ) ) {
6552 lastCid = result . cid . toString ( ) ;
66- // Progress callback (approximate)
67- if ( onProgress && result . size ) {
68- uploadedSize += result . size ;
69- onProgress ( Math . min ( uploadedSize / totalSize , 1 ) ) ;
70- }
53+ // Progress is now handled by kuboClient.addAll's progress callback
7154 }
7255 if ( ! lastCid ) throw Error ( "No CID returned from IPFS add" ) ;
7356 return `/ipfs/${ lastCid } ` ;
You can’t perform that action at this time.
0 commit comments