@@ -10,8 +10,6 @@ const readdir = promisify(fs.readdir);
10
10
// This script is used to retrieve data generated by `go run generate.go` at backend folder.
11
11
// It will generate registry data that will be used by this script to feed into wrangler dev folder, mimicking a R2 bucket.
12
12
// This script expects data will be at /tmp/registry.
13
-
14
- const BATCH_SIZE = 2
15
13
const DIR_PATH = '/tmp/registry' ;
16
14
17
15
const putObject = ( directoryPath ) => async ( filename , i ) => {
@@ -20,7 +18,7 @@ const putObject = (directoryPath) => async (filename, i) => {
20
18
21
19
try {
22
20
const stats = await stat ( realFilePath )
23
- // directories are not supported by wrangler api and
21
+ // Directories are not supported by ` wrangler r2` API and
24
22
// not needed since wrangler create the path without using folders.
25
23
if ( stats . isDirectory ( ) ) return
26
24
} catch ( err ) {
@@ -47,9 +45,8 @@ const run = async () => {
47
45
console . log ( `Reading ${ DIR_PATH } ...` )
48
46
const files = await readdir ( DIR_PATH , { recursive : true } ) ;
49
47
const total = files . length ;
50
- const batches = Math . ceil ( total / BATCH_SIZE ) ;
51
48
52
- console . log ( `Processing about ${ total } files/folders in ${ batches } batches ...` ) ;
49
+ console . log ( `Processing about ${ total } files/folders...` ) ;
53
50
// We're processing sequentially because wranger r2 put doesn't handle
54
51
// well concurrency giving a lot of errors, even with 2 files at once.
55
52
for ( const f of files ) {
0 commit comments