Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

Commit

Permalink
Copy in chunks of 100 with multiple cp threads
Browse files Browse the repository at this point in the history
  • Loading branch information
J053Fabi0 committed Sep 8, 2023
1 parent 4b75ff6 commit b7c08ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"tasks": {
"run": "deno run --allow-net --allow-write --allow-run --allow-env --allow-read index.ts",
"check": "deno check mod.ts"
},
"imports": {
"lodash": "https://deno.land/x/[email protected]/mod.ts"
}
}
4 changes: 3 additions & 1 deletion src/copyData.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { lodash as _ } from "lodash";
import { cp } from "../utils/commands.ts";
import getFiles from "../utils/getFiles.ts";
import { join, MultiProgressBar } from "../deps.ts";
Expand Down Expand Up @@ -61,7 +62,8 @@ export default async function copyData(
})();

console.log("Copying the rest of the files with copy, including directories");
await cp([...otherFiles.map((f) => `${join(fromShardPath, f.name)}`), toShardPath]);
const filesWithFullPath = otherFiles.map((f) => join(fromShardPath, f.name));
await Promise.all(_.chunk(filesWithFullPath, 100).map((files) => cp([...files, toShardPath])));

i = Infinity;
if (logProgressBar) {
Expand Down

0 comments on commit b7c08ee

Please sign in to comment.