mirror of
https://github.com/RGBCube/serenity
synced 2025-05-24 15:35:06 +00:00

This test proves the ability of structuredClone() to serialize and deserialize a File object.
20 lines
750 B
HTML
20 lines
750 B
HTML
<script src="../include.js"></script>
|
|
<script>
|
|
asyncTest(async done => {
|
|
let blob = structuredClone(new Blob(["Hello, Blob!"], {type: "text/plain"}));
|
|
println(`instanceOf Blob: ${blob instanceof Blob}`);
|
|
println(`Blob.type: ${blob.type}`);
|
|
let text = await blob.text();
|
|
println(`Blob.text(): ${text}`);
|
|
|
|
let file = structuredClone(new File(["Hello, File!"], "hello.txt", {type: "text/plain"}));
|
|
println(`instanceOf File: ${file instanceof File}`);
|
|
println(`File.name: ${file.name}`);
|
|
println(`File.type: ${file.type}`);
|
|
text = await file.text();
|
|
println(`File.text(): ${text}`);
|
|
println(`File.size: ${file.size}`);
|
|
|
|
done();
|
|
});
|
|
</script>
|