github remix-run/remix form-data-middleware@1.1.0
form-data-middleware v1.1.0

latest releases: ui@0.13.0, remix@3.1.0, static-middleware@1.0.1...
3 hours ago

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

Don't miss a new remix release

NewReleases is sending notifications on new releases.