Comments (10)
Actually, I am preparing to implement Read
for Upload
, which will probably be completed tomorrow. Because this depends on the new parser.๐
from async-graphql.
Sorry didnโt realise. Thatโll awesome!
from async-graphql.
This is very difficult to achieve, and I don't think GraphlQL can do it. ๐
from async-graphql.
So I was reading about it, I think it would be possible but only when you have one file. In theory we could get a stream of the body directly from the TCP stream after we read the query and the map of files.
You are right, it can indeed be optimized when only one file is uploaded, I will think about it. ๐
from async-graphql.
I'm also leaning towards the first option, and I want to remove the dependency on the actix-multipart
to make it more compatible with other web servers. The actix-multipart
input is Stream<Item=Bytes>
, but I want it to be an AsyncRead
. I searched existing crates and didn't have a working asynchronous multipart parser, so I probably had to write a new one.
Then add a function like Schema::query_from_request<R: AsyncRead>(&self, content_type: &str, body: R)
, should be easier to use.
from async-graphql.
Sounds good. ๐
from async-graphql.
I ended up choosing the first option because the second option had some problems with the order of requests.
from async-graphql.
@sunli829 I was reading the code and as far as I understand the file needs to be completely uploaded (either in memory or in temp) before it is returned as an async stream. This is not great for large files where you might want to stream the data without buffering it. Unsure if it is doable though.
from async-graphql.
So I was reading about it, I think it would be possible but only when you have one file. In theory we could get a stream of the body directly from the TCP stream after we read the query and the map of files.
But if you upload more than one file you need to buffer for sure to the disk. Still for a lot of cases it would be a worthwhile optimisation. Just unsure if you want to support it @sunli829
My use case is that users are uploading large files to the server and since tempfile is used I can't just move them where I want, I have to copy them so for a bit of time I have 2x the disk usage which is annoying. An alternative that would work for me would be to have a named file, so maybe that would be a better approach (just another feature flag).
from async-graphql.
Iโm reading this thread since I originally opened the issue. I currently do not use this library anymore. Just wondering @Sytten canโt you just persist the tempfile? In general I think it would be good if one could get a reference to an AsyncRead of the uploaded content.
from async-graphql.
Related Issues (20)
- Access the value of "variable" arguments (`Value::Variable`)
- Has anyone does any benchmarks because im getting extremely poor results and I do not know why? HOT 8
- Get mutable referenece to the global data defined in the `Context` or `Schema` HOT 1
- Confusing `unused_mut` warning in `#[Object]` HOT 8
- How to handle both directions of one-to-many relation in federated graph
- Question: How to get server to send ping messages on subscriptions? HOT 2
- Parsing multiple operations in a file HOT 1
- Non nullable variables should allow default values HOT 3
- Object with single skipped field but with ComplexObject HOT 2
- As using proxy type
- Using flatten inside an impl with no other fields causes a compile error
- Subscription with MPSC receiver in context data
- Reduce clippy noise from #[Object] macro HOT 2
- Guard trait lifetime HOT 1
- Using generics with both SimpleObject and InputObject as field in output type fails HOT 1
- Subscription Authentication
- Stack overflow after upgrade to 7.0.2 HOT 3
- Does async-graphql validate responses?
- Error reading data from ExtensionContext after upgrade to 7.0.3
- Create a general error formateer
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from async-graphql.