socket.io-file | node module for uploading file via Socket | Socket library
kandi X-RAY | socket.io-file Summary
kandi X-RAY | socket.io-file Summary
Socket.io-file is a node module for uploading file via Socket.io module
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Initialize a new SocketFileFile .
- Write the chunk to the write stream .
- makedir recursively
- Send an error to the upload .
- Create a directory if it doesn t exist
socket.io-file Key Features
socket.io-file Examples and Code Snippets
Community Discussions
Trending Discussions on socket.io-file
QUESTION
A Node.js example for a Google API contains this (for the server code). This is from Google's examples on GitHub, simplified for the purpose here:
...ANSWER
Answered 2018-Apr-11 at 21:30If you had looked at the documentation for client.longRunningRecognize()
, you would have seen that request.audio
could instead contain a URI to a google cloud store audio file.
Based on this approach, you could choose to stream fs.createReadStream(filename)
as an upload to that location before calling the client.longRunningRecognize()
with a request object using the RecognitionAudio#uri
to the destination of the streamed upload instead of RecognitionAudio#content
as a base64 string of the file.
That would prevent blocking the event loop like fs.readFileSync()
would, and it would avoid buffering the whole file in memory like both fs.readFileSync()
and fs.readFile()
would.
It also appears that passing a protobuffer
to RecognitionAudio#content
would allow you to stream the audio data directly to the API request, though looking into that approach would require more knowledge about how this works.
QUESTION
First off, I know this seems illogical when I could just send the download URL to the server. The issue with that is that user's can access these download links and so for those who can I need to be able to download it. I can't really explain why as I am under NDA.
I am trying to download a file from a URL via the client (browser) and stream the data directly to the server where the file is saved so the client essentially acts as a "middleman" and does not require the file to be downloaded to the client's machine.
I have been experimenting with "socket.io-stream" and "socket.io-file" but i am having a few issues with both. "socket.io-stream" allows me to upload a specific file from the client to the server but the uploaded file has a size of 0kb and doesn't have any examples on Github.
"socket.io-file" has examples, which I followed and currently have it setup so I can use an input tag to select a file to upload to the server successfully.
From what I can see the "socket.io-file" upload function takes a file object as the parameter.
So I have two questions really:
Is there a plugin for JS (Browser) & NodeJs (Server) that would allow me to do this?
or
How can I create a File Object from an external url?
ANSWER
Answered 2017-Nov-20 at 17:56I solved this is the end, using a chrome extension to download the file as a blob object, pass the object to the content script and then use socket.io-stream to upload it to the server.
QUESTION
After searching the depths of SO and google, I've hit a wall. I can't for the life of me figure out how/why the socket is not catching the file I'm uploading via form, it just stops after connecting. When I check the console, I'm only seeing the form submit confirmation and then dialog click confirmation. I'm sure it's a fairly simple solution so I apologize if I'm making it more complicated than needed.
Server
...ANSWER
Answered 2018-Jan-17 at 23:15Resolved by placing emit function inside uploader.on('complete'...)
rather than outside of the entire process.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
Install socket.io-file
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page