When I wanted to do file sharing I'm stuck up with this error
The error is fs.creatreadstream() is not a function ? Am i missing out anything even after performing browserify for the client side and using require('fs')
I'm following the below documentation!!!
https://github.com/nkzawa/socket.io-stream
Asked
Active
Viewed 509 times
0

krishnaa sa
- 11
- 1
- 5
-
Possible duplicate of [Browserify with require('fs')](http://stackoverflow.com/questions/16640177/browserify-with-requirefs) – Joe Clay Apr 03 '16 at 12:00
-
i have tried with both browserify-fs and browserify with require('fs') on the client side with the following command : browserify chat.js -o hello.js -d where chat.js is the client. It still shows the error fs.createReadStream() is not a function. Thanks in Advance ! – krishnaa sa Apr 04 '16 at 10:33
-
You can't require `fs` on the client-side, as the question I linked mentions. Node has full access to the filesystem, browsers only have a limited subset of functionality available ([and they're no longer adding it to the HTML spec](http://lists.w3.org/Archives/Public/public-webapps/2014AprJun/0010.html)), so it wouldn't make sense for the same API to be available - Browserify just gives you an empty object instead, hence the error. [You need to look at the 'browser' section of the `socket.io-stream` documentation instead.](https://github.com/nkzawa/socket.io-stream#browser) – Joe Clay Apr 04 '16 at 12:19
-
I took the help of this link : http://stackoverflow.com/questions/30025004/how-to-upload-file-using-socket-io-stream but then my output is : { data: {}, size: 364483, name: 'Motivational-Quotes-43.jpg' } there is no content in the data . how can i solve it? Really Thanks. – krishnaa sa Apr 04 '16 at 13:08