release: WRNexusJS 0.8.0
This commit is contained in:
@@ -108,6 +108,11 @@ export const GET = serveFromStore("docs"); // your middleware decides who gets i
|
||||
|
||||
## API
|
||||
|
||||
Uploads can participate in security and media pipelines without changing storage drivers. Pass a
|
||||
`scan` hook to reject malware/DLP findings before storage, and `afterStore` to enqueue image/video
|
||||
processing or indexing. If post-processing throws, WRNexus deletes the newly written object so a
|
||||
partially accepted upload is never left behind.
|
||||
|
||||
| Export | What |
|
||||
| --------------------------------------- | --------------------------------------------------------------- |
|
||||
| `handleUpload(opts)` | POST route handler → JSON `{ ok, files }` |
|
||||
@@ -123,3 +128,36 @@ export const GET = serveFromStore("docs"); // your middleware decides who gets i
|
||||
- SigV4 signing is implemented from scratch (no `@aws-sdk`); tested against local S3 semantics.
|
||||
Live AWS/R2 connectivity depends on your credentials + bucket policy.
|
||||
- v1 buffers each file in memory up to its size cap (fine for images/docs up to tens of MB).
|
||||
|
||||
## Helper and component kit
|
||||
|
||||
Use `formatFileSize`, `uploadAccept`, `uploadedFileMap`, `uploaderAttributes`, and `assertUploadedFiles` to keep upload forms and server validation consistent.
|
||||
|
||||
Enable `uploaderPlugin()` for:
|
||||
|
||||
- `<UploadDropzone />`
|
||||
- `<UploadStatus />`
|
||||
|
||||
The complete blocks compose `Card`, `Alert`, and `Badge` from `@wrnexus/ui`; the specialized upload runtime remains responsible for the native file input and secure transport behavior.
|
||||
Large files can use `createResumableUploadManager`. Sessions are bounded and
|
||||
expiring; chunks may arrive out of order, carry SHA-256 checksums, and are
|
||||
idempotent when retried. Conflicting retries reject, and the object is assembled
|
||||
only after every exact-sized chunk is present.
|
||||
|
||||
```ts
|
||||
const uploads = createResumableUploadManager({
|
||||
driver: getStore("documents").driver,
|
||||
sessions: redisUploadSessionStore,
|
||||
chunkSize: 5 * 1024 * 1024,
|
||||
maxBytes: 500 * 1024 * 1024,
|
||||
accept: ["application/pdf"],
|
||||
});
|
||||
|
||||
const session = await uploads.create({ name: "report.pdf", size, type });
|
||||
await uploads.uploadChunk(session.id, index, bytes, sha256);
|
||||
```
|
||||
|
||||
The included memory session store is intended for one-process apps and tests.
|
||||
Multi-instance production deployments should implement `ResumableSessionStore`
|
||||
with shared durable storage and atomic session updates, and periodically call
|
||||
`prune()` for abandoned uploads.
|
||||
|
||||
Reference in New Issue
Block a user