hgouveia / node-downloader-helper

A simple http file downloader for node.js
MIT License
253 stars 54 forks source link

can i use this package with ftp protcol #19

Open abdolrhman opened 4 years ago

abdolrhman commented 4 years ago

can i download files with ftp protocol instead of http ?

hgouveia commented 4 years ago

@abdolrhman at the moment does not support FTP, I will consider adding support in future releases

abdolrhman commented 4 years ago

I could help you with implementing FTP ... I need to have this functinality for node-ftp, as there is no ftp node package that implement this functialities . what do u think ?

hgouveia commented 4 years ago

I could help you with implementing FTP ... I need to have this functinality for node-ftp, as there is no ftp node package that implement this functialities . what do u think ?

I was checking this possibility earlier today but I didn't find a simple way of implementing using just native node.js since one of the goals of this library is not to have dependencies. Is possible to implement it completely native but I will end up creating an entire FTP client because you need to take in consideration a lot of scenarios, for example, Authorization, FTPS, TLS, etc

after some consideration, I think if any user needs to use FTP is better just to use node-ftp directly or another library that provides this functionality, I also was considering to have "plugins system" and this could be a plugin

abdolrhman commented 4 years ago

so your thinking to create a plugin for node-ftp or for any package that implements this protocl, as for implememinting this functionalites ? because i was thinking to do the same, till i saw your package. so i thought we could close the gaps and create some thing similar for ftp

hgouveia commented 4 years ago

so your thinking to create a plugin for node-ftp or for any package that implements this protocl, as for implememinting this functionalites ? because i was thinking to do the same, till i saw your package. so i thought we could close the gaps and create some thing similar for ftp

I was thinking more the possibility to add a plugin/middleware system to this library,

something like

const { DownloaderHelper } = require('node-downloader-helper');
const ftpPlugin = require('node-downloader-helper/ftp-plugin');
const dl = new DownloaderHelper('ftp://www.ovh.net/files/1Gio.dat', __dirname);

dl.use(ftpPlugin({user, pass, secure:true /*...more opts*/ )); // or DownloaderHelper.use(ftpPlugin);
dl.on('end', () => console.log('Download Completed'))
dl.start();

and basically will use ftpPlugin to handle the 'download' operation, and this can bring more possibilities to extended it

ftpPlugin could be just a wrapper of node-ftp to handle the download only, since we don't need to care about upload

abdolrhman commented 4 years ago

that would be a fantastic thing, because from where i see , there is no package at all that implement the download from ftp with respect for (stop/ resume/ cancel ) the download, implementing this will change the game, And i think will attract alot of people, because download by ftp is more secure and better than download from http.