File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
packages/cloudflare/src/cli/commands Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 11import fs from "node:fs" ;
2+ import fsp from "node:fs/promises" ;
23import os from "node:os" ;
34import path from "node:path" ;
45
@@ -239,8 +240,8 @@ async function populateR2IncrementalCache(
239240 file : fullPath ,
240241 } ) ) ;
241242
242- const listFile = path . join ( os . tmpdir ( ) , `r2-bulk-list.json` ) ;
243-
243+ const tempDir = await fsp . mkdtemp ( path . join ( os . tmpdir ( ) , "open-next-" ) ) ;
244+ const listFile = path . join ( tempDir , `r2-bulk-list.json` ) ;
244245 fs . writeFileSync ( listFile , JSON . stringify ( objectList ) ) ;
245246
246247 const concurrency = Math . max ( 1 , populateCacheOptions . cacheChunkSize ?? 50 ) ;
@@ -287,8 +288,10 @@ async function populateKVIncrementalCache(
287288
288289 logger . info ( `Inserting ${ assets . length } assets to KV in chunks of ${ chunkSize } ` ) ;
289290
291+ const tempDir = await fsp . mkdtemp ( path . join ( os . tmpdir ( ) , "open-next-" ) ) ;
292+
290293 for ( const i of tqdm ( Array . from ( { length : totalChunks } , ( _ , i ) => i ) ) ) {
291- const chunkPath = path . join ( buildOpts . outputDir , "cloudflare" , `cache-chunk-${ i } .json` ) ;
294+ const chunkPath = path . join ( tempDir , `cache-chunk-${ i } .json` ) ;
292295
293296 const kvMapping = assets
294297 . slice ( i * chunkSize , ( i + 1 ) * chunkSize )
You can’t perform that action at this time.
0 commit comments