Comments (5)
Currently we are using this https://github.com/wkh237/react-native-fetch-blob. Working pretty well with multi-part but we're not stress testing with huge files. We're drastically shrinking the file size to save data when not on wifi.
For streaming I'm not sure. I think you could use sockets for it. That issue is definitely related.
On the server side, there is some sweet stuff happening with Multer. They have a streaming branch in the works (multer@next
). I really like the look of it but haven't had time to test it out just yet. In theory you should be able to stream all the way from client to server to the final storage destination, which would be
How I got along that train of thought was specifically being able to transform files prior to saving them somewhere (ie. cropping before shipping to S3).
Related:
from feathers-rest.
I haven't tried it yet but any reason
const multer = require('multer')
const upload = multer({ dest: 'uploads/' })
const fileService = {
create(data, params) {
// data is the file
return Promise.resolve({});
}
}
function setFile(req, res, next) {
req.body = req.file;
next();
}
app.post('/upload', upload.single('avatar'), setFile, fileService);
Wouldn't work?
from feathers-rest.
@daffl the server side piece works just fine. I mean from the client side. Currently, you need to circumvent feathers-client and use the underlying REST lib (superagent, request, axios, etc.) directly in order to upload via multipart/form. You can't just set hook.params.headers['Content-Type]
. I don't know enough about the data structure format of multipart uploads but I think we can make it much easier to do file uploads on the client.
I'm also interested in exploring socket file upload. There seems to be a couple modules that do it in a non-feathers way, I wonder if we can adapt it (it's a great use of sockets imho).
You can use these two:
or this modules:
Most file upload implementations use base64 encoding. For large images this can be expensive on memory, especially on mobile. There are also some interesting constraints with React Native, base64 encoding a big image and uploading in your JS thread locks the UI so ideally you want that part to happen on the native side and you just have a JS interface into it.
from feathers-rest.
How would you normally stream it in RN? I think feathersjs/feathers#384 might be related.
from feathers-rest.
I'm going to close this in favour of continuing the discussion in the proposal for stream support at feathersjs/feathers#609
from feathers-rest.
Related Issues (20)
- Add headers and remote IP
- res.hook should exist in middleware after errors
- Setting 'content-type' header properly with boundary HOT 3
- $in: [] returning unexpected results HOT 2
- JSON-API + feathers-rest HOT 4
- Property 'axios' does not exist on type 'Transport' HOT 4
- $gte query example? HOT 2
- Map route parameters to `params.route` HOT 1
- How to return a pdf download file instead of data ?
- Update returning 204 HOT 2
- An in-range update of feathers is breaking the build 🚨 HOT 1
- Prepare for feathers v3 HOT 9
- Angular http implementation error HOT 1
- Client fails to parse json response on 204 status using fetch HOT 2
- $in operator doesn't work correctly through rest HOT 15
- fn.call is not a function(…) on client side with webpack HOT 2
- Client: Support Service Middleware / Generic Service HOT 5
- support axios? HOT 3
- Custom HTTP status code response HOT 4
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 feathers-rest.