Middleware and an Upload scalar to add support for GraphQL multipart requests (file uploads via queries and mutations) to various Node.js GraphQL servers. Clients implementing the GraphQL multipart request spec upload files as Upload scalar query or mutation variables. Their resolver values are promises that resolve file upload details for processing and storage. Files are typically streamed into cloud storage but may also be stored in the filesystem. Use the middleware graphqlUploadKoa or graphqlUploadExpress just before GraphQL middleware. Alternatively, use the function processRequest to create custom middleware. The process must have both read and write access to the directory identified by os.tmpdir(). The device requires sufficient disk space to buffer the expected number of concurrent upload requests. Promisify and await file upload streams in resolvers or the server will send a response to the client before uploads are complete, causing a disconnect.

Features

  • Handle file upload promise rejection and stream errors
  • Process multiple uploads asynchronously
  • Only use the function createReadStream before the resolver returns
  • The GraphQL multipart request spec allows a file to be used for multiple query or mutation variables fs-capacitor is used to buffer file uploads to the filesystem and coordinate simultaneous reading and writing
  • The npm package graphql-upload features optimal JavaScript module design
  • Middleware and an Upload scalar to add support for GraphQL multipart requests

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow graphql-upload

graphql-upload Web Site

You Might Also Like
SKUDONET Open Source Load Balancer Icon
SKUDONET Open Source Load Balancer

Take advantage of Open Source Load Balancer to elevate your business security and IT infrastructure with a custom ADC Solution.

SKUDONET ADC, operates at the application layer, efficiently distributing network load and application load across multiple servers. This not only enhances the performance of your application but also ensures that your web servers can handle more traffic seamlessly.
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of graphql-upload!

Additional Project Details

Programming Language

JavaScript

Related Categories

JavaScript Frameworks, JavaScript Web Development Software

Registered

2022-10-31