https://github.com/theoomoregbee/skipper-ftp
Uploading files directly to FTP server using skipper and node-ftp
https://github.com/theoomoregbee/skipper-ftp
ftp sails skipper upload
Last synced: 10 months ago
JSON representation
Uploading files directly to FTP server using skipper and node-ftp
- Host: GitHub
- URL: https://github.com/theoomoregbee/skipper-ftp
- Owner: theoomoregbee
- License: mit
- Created: 2017-10-05T15:33:13.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-11T04:07:37.000Z (over 8 years ago)
- Last Synced: 2024-04-30T04:41:52.409Z (over 1 year ago)
- Topics: ftp, sails, skipper, upload
- Language: JavaScript
- Homepage:
- Size: 186 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# [
](https://github.com/willhuang85/skipper-gridfs) Skipper FTP Adapter
[](https://www.npmjs.com/package/skipper-ftp)
[]()
This is used to upload files directly to FTP server using [skipper](https://github.com/balderdashy/skipper) and [node-ftp](https://github.com/mscdex/node-ftp)
## Installation
```
$ npm install skipper-ftp --save
```
Also make sure you have skipper [installed as your body parser](http://beta.sailsjs.org/#/documentation/concepts/Middleware?q=adding-or-overriding-http-middleware).
> Skipper is installed by default in [Sails](https://github.com/balderdashy/sails) v0.10.
## Usage
```javascript
req.file('file')
.upload({
adapter: require('skipper-ftp'),
host: 'ftp.localhost',
port: 21,
username:'root',
password:'root',
path:'/'
}, function whenDone(err, uploadedFiles) {
if (err) return res.negotiate(err);
else return res.ok({
files: uploadedFiles
});
});
```
| Option | Type | Details |
|----------- |:----------:|---------|
| `host` | ((string)) | An optional parameter of the host or domain/IP. Default value: `localhost`|
| `port` | ((number)) | An optional parameter for port. Default value :`21`|
| `path` | ((string)) | An optional parameter if you wish to save the file in a particular path in your file server. Default value :`/`|
| `user` | ((string)) | An optional parameter for authentication. Default value :`root`|
| `password` | ((string)) | An optional parameter for authentication. Default value :`root`|
check [node-ftp](https://github.com/mscdex/node-ftp#methods) options for more
## UploadedFiles
The meta data is returned along with **`extra`** which may contain `error` field. The `error` is going to return and error encountered while uploading the file to your FTP server
## Testing
* Clone this repository
* Install all development dependencies
```sh
$ npm install
```
* Then run test
```sh
$ npm test
```
## Contribute
Fork this repo and push in your ideas.
Do not forget to follow [skipper-adapter-test](https://github.com/balderdashy/skipper-adapter-tests) standards
## License
MIT License (MIT)