Book Image

CoffeeScript Application Development Cookbook

By : Mike Hatfield
Book Image

CoffeeScript Application Development Cookbook

By: Mike Hatfield

Overview of this book

Table of Contents (18 chapters)
CoffeeScript Application Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Transferring files via FTP


File Transfer Protocol (FTP) is nearly as old as the Internet itself, and is still one of the most common methods to transfer files to and from servers.
In this recipe, we will demonstrate how to upload to and download from a remote server using FTP.

Getting ready

We will use the Node-ftp npm module. Node-ftp provides a ride implementation of the FTP specification and allows us to connect to FTP servers, transfer files to and from the server, as well as manage files and directories.

You will require access to an FTP server to run the examples in this section.

To begin, we will install the Node-ftp module with the following command:

npm install ftp --save

We will also use the Q library to help with calling our methods in sequence. Install Q using the following command:

npm install q --save

We will also create a file that will contain our FTP configuration settings. Create a file called ftp-config.coffee with the following code:

module.exports =
  host: 'mwhatfield.com...