Skip to content

form-data-middleware v1.1.0

Choose a tag to compare

@github-actions github-actions released this 23 Oct 18:42
· 3 commits to main since this release
03c8414

Minor Changes

  • Add a @remix-run/form-data-middleware/future entrypoint whose formData() middleware parses requests with @remix-run/form-data-parser/future, so file uploads stream to your uploadHandler instead of being buffered in memory. Future APIs are not stable and may change in any release, but they are a good indication of where this package will land in its next major release. (#12030)

    In our benchmarks, parsing a request with a 100 MiB file through the future parser takes 37 ms instead of 68 ms and grows peak memory by 29 MiB instead of 396 MiB. See the @remix-run/form-data-parser changelog for the full comparison.

    import { formData } from '@remix-run/form-data-middleware/future'
    
    let middleware = formData({
      async uploadHandler(fileUpload) {
        let storageKey = crypto.randomUUID()
        await fileStorage.set(storageKey, fileUpload)
        return storageKey
      },
    })

    If your app handles file uploads, please give @remix-run/form-data-middleware/future a try and tell us how it goes in GitHub Discussions. We'd especially like to hear about anything that breaks, behaves unexpectedly, or feels awkward, since that feedback will shape the next major release.

Patch Changes