Skip to content

Commit

Permalink
πŸ“ Document uploadFilesWithProgress (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
coyotte508 authored Nov 9, 2023
1 parent a8b92d0 commit 2eb77b6
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/hub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Check out the [full documentation](https://huggingface.co/docs/huggingface.js/hu
For some of the calls, you need to create an account and generate an [access token](https://huggingface.co/settings/tokens).

```ts
import { createRepo, uploadFiles, deleteFile, deleteRepo, listFiles, whoAmI } from "@huggingface/hub";
import { createRepo, uploadFiles, uploadFilesWithProgress, deleteFile, deleteRepo, listFiles, whoAmI } from "@huggingface/hub";
import type { RepoDesignation, Credentials } from "@huggingface/hub";

const repo: RepoDesignation = { type: "model", name: "myname/some-model" };
Expand Down Expand Up @@ -64,6 +64,18 @@ await uploadFiles({
],
});

// or

for await (const progressEvent of await uploadFilesWithProgress({
repo,
credentials,
files: [
...
],
})) {
console.log(progressEvent);
}

await deleteFile({repo, credentials, path: "myfile.bin"});

await (await downloadFile({ repo, path: "README.md" })).text();
Expand Down

0 comments on commit 2eb77b6

Please sign in to comment.