BoxInspect

fix: offset issues corrected

3/23/2021 10:20:48 PM

Changes

index.js 2(+1 -1)

Details

index.js 2(+1 -1)

diff --git a/index.js b/index.js
index 4e001af..fab8cfe 100644
--- a/index.js
+++ b/index.js
@@ -25,7 +25,7 @@ const getFolderContents = async (id) => {
   const iterations = Math.floor(r.item_collection.total_count / chunks)
   const files = []
   for (let i = 0; i <= iterations; i++) {
-    let items = await client.folders.get(id, {limit: chunks, offset: i})
+    let items = await client.folders.get(id, {limit: chunks, offset: (chunks * i)})
     let parts = items.item_collection.entries.filter(f => f.type === 'file').map(f => { return [f.name.split('.')[0], f.id, f.name, `${process.env.PUBLIC_URL}${f.id}`] })
     files.push(...parts)
     console.log(id, i, '/', iterations)