Release 0.0.4

This commit is contained in:
Schluffe committed 2026-10-16 14:57:17 +02:00
1 parent 7856725c72
commit 3ae47dde8e
10 files changed
+56 -26

No files matched your search

+9
View File
@@ -84,3 +84,12 @@ test('app cancellation errors the browser response and cancels pending source re
assert.equal(canceled, true);
assert.equal(w.messages.at(-1)?.type, 'error');
});
test('download worker accepts sizes above 64 GiB without allocating the file', async () => {
const w = worker();
const size = 64 * 1024 ** 3 + 1;
w.start(new ReadableStream(), size);
const response = await w.fetch();
assert.equal(response.headers.get('Content-Length'), String(size));
await response.body!.cancel();
});
+8 -2
View File
@@ -1,7 +1,7 @@
import test, { type TestContext } from 'node:test';
import type { TransferChannel, TransferOptions, TransferResult } from '../src/lib/transfer.ts';
import assert from 'node:assert/strict';
import { Transfer, MEMORY_LIMIT, FILE_LIMIT, validateMetadata } from '../src/lib/transfer.ts';
import { Transfer, MEMORY_LIMIT, validateMetadata } from '../src/lib/transfer.ts';
import { CHUNK_SIZE, MAX_BUFFERED } from '../src/lib/webrtc.ts';
class Channel extends EventTarget implements TransferChannel {
@@ -167,7 +167,7 @@ test('memory limit requires an explicit disk destination for larger files', asyn
});
test('metadata rejects invalid sizes, misleading names and invalid types', () => {
for (const size of [-1, 0.5, '10', NaN, Infinity, FILE_LIMIT + 1]) assert.throws(() => validateMetadata({ ...meta(), size }));
for (const size of [-1, 0.5, '10', NaN, Infinity, Number.MAX_SAFE_INTEGER + 1]) assert.throws(() => validateMetadata({ ...meta(), size }));
for (const name of ['', '../secret', 'a\\b', 'bad\u202efile.exe', 'a'.repeat(256)]) assert.throws(() => validateMetadata({ ...meta(), name }));
assert.throws(() => validateMetadata({ ...meta(), mime: {} }));
});
@@ -225,3 +225,9 @@ test('forged completion or invalid byte acknowledgments cannot report success',
message(second.sender, 'ack', { bytes: 1 }); await second.sender.queue;
assert.equal(second.sender.state, 'closed');
});
test('metadata accepts files above 64 GiB while preserving exact byte counts', () => {
for (const size of [64 * 1024 ** 3 + 1, 1024 ** 4, Number.MAX_SAFE_INTEGER]) {
assert.equal(validateMetadata({ ...meta(), size }).size, size);
}
});