Skip to content

v1.3.3

Choose a tag to compare

@iwater iwater released this 11 Dec 14:48
· 20 commits to main since this release

Add buffer upload plugin with ArrayBuffer support

Summary

Implemented new Buffer Upload Plugin that processes file uploads in memory and passes data as ArrayBuffer to JavaScript callbacks, along with necessary framework updates.

Changes

  1. Rust Plugin :

    • Created new plugin to handle file uploads in memory (100MB limit)
    • Stores file contents directly into request body as binary data
    • Adds upload metadata (filename, size, content-type) to request headers
  2. TypeScript Definitions (HttpServer.nitro.ts):

    • Added BufferUploadMount interface with type: 'buffer_upload'
    • Updated Mountable union type to include new plugin
    • Enhanced HttpRequest interface with binaryBody?: ArrayBuffer field
  3. C++ Bridge Fix (HybridHttpServer.cpp):

    • Fixed binary data handling for Nitro modules
    • Added proper detection for buffer upload requests via headers
  4. Documentation (README.md, README_zh.md):

    • Added plugin to features list
    • Included configuration examples
    • Updated type definitions and FAQ section
    • Explained differences between disk-based and memory-based uploads

Key Features

✅ In-memory file upload processing (up to 100MB)
✅ Direct ArrayBuffer access in JavaScript callbacks
✅ Seamless integration with existing mount-based architecture
✅ Comprehensive type safety with TypeScript definitions
✅ Fixed C++ compilation issues for binary data handling

The buffer upload plugin provides efficient in-memory processing for smaller files while maintaining compatibility with the existing upload infrastructure.