Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing ftp using Javascript

Tags:

browser

ftp

I dont understand why cant javascript make ftp calls?. Why do we have to make such a request using server?

Even Browsers have ability to authenticate and browse a ftp server. Maybe use browser api's to do it?

like image 832
iamkhush Avatar asked Nov 15 '14 14:11

iamkhush


People also ask

What is FTP in Javascript?

FTP (File Transfer Protocol) is an insecure protocol for transferring files from one host to another over the Internet.

What is FTP in node JS?

This is an FTP client library for Node. js. It supports FTPS over TLS, Passive Mode over IPv6, has a Promise-based API, and offers methods to operate on whole directories.


2 Answers

Ok, answering my own question here.

I went through Mozilla docs on XMLHTTPRequest. It specifically says -

Despite its name, XMLHttpRequest can be used to retrieve any type of data, not just XML, and it supports protocols other than HTTP (including file and ftp).

So, I am satisfied with this. JavaScript can make calls to ftp using this.

like image 128
iamkhush Avatar answered Oct 01 '22 01:10

iamkhush


The title of this question suggests the requester is keen on understanding if an FTP transfer could be implemented using JavaScript. However looking at the the answer by the same requester it appears that the question was just to know if URLs with FTP protocols can be used with JS and possibly HTML tags. The answer is yes. Even a simple <a> tag supports FTP URLs in the href attribute. Hope this helps the new readers. And yes, the XMLHttpRequest AJAX object does enable calling a URL with an FTP protocol.

Cheers.

like image 24
Kartik Avatar answered Oct 01 '22 02:10

Kartik