Skip to content

Commit 66253c7

Browse files
coyotte508Wauplin
andauthored
Also test web blob on xet file (#1231)
Follow up #1230 cc @Wauplin Since the header should be present now Co-authored-by: Lucain <[email protected]>
1 parent 2e596a0 commit 66253c7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/hub/src/utils/WebBlob.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,18 @@ describe("WebBlob", () => {
6060
expect(await webBlob.slice(10, 22).text()).toBe("__metadata__");
6161
});
6262

63+
it("should lazy load a Xet file hosted on Hugging Face", async () => {
64+
const stableDiffusionUrl =
65+
"https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/unet/diffusion_pytorch_model.fp16.safetensors";
66+
const url = new URL(stableDiffusionUrl);
67+
const webBlob = await WebBlob.create(url);
68+
69+
expect(webBlob.size).toBe(5_135_149_760);
70+
expect(webBlob).toBeInstanceOf(WebBlob);
71+
expect(webBlob).toMatchObject({ url });
72+
expect(await webBlob.slice(10, 22).text()).toBe("__metadata__");
73+
});
74+
6375
it("should create a slice on the file", async () => {
6476
const expectedText = fullText.slice(10, 20);
6577

0 commit comments

Comments
 (0)