This repository has been archived on 2022-07-06. You can view files and clone it, but cannot push or open issues or pull requests.
websocket-webcam/node_modules/jsftp/package.json

60 lines
8.1 KiB
JSON

{
"name": "jsftp",
"id": "jsftp",
"version": "1.1.1",
"description": "A sane FTP client implementation for NodeJS",
"keywords": [
"ftp",
"protocol",
"files",
"server",
"client",
"async"
],
"author": {
"name": "Sergi Mansilla",
"email": "sergi.mansilla@gmail.com",
"url": "http://sergimansilla.com"
},
"homepage": "https://github.com/sergi/jsftp",
"repository": {
"type": "git",
"url": "https://github.com/sergi/jsftp.git"
},
"bugs": {
"url": "https://github.com/sergi/jsftp/issues"
},
"dependencies": {
"event-stream": "~3.0.14",
"parse-listing": "~1.0.0",
"async": "~0.2.9"
},
"devDependencies": {
"mocha": "~1.10.0",
"istanbul": "~0.1.36",
"mocha-istanbul": "~0.2.0",
"sinon": "~1.7.2",
"ftp-test-server": "~0.0.1",
"rimraf": "~2.2.0"
},
"main": "./jsftp.js",
"engines": {
"node": ">=0.6.21"
},
"scripts": {
"test": "mocha -R spec -t 5000"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/sergi/jsftp/blob/master/LICENSE"
}
],
"readme": "jsftp <a href=\"http://flattr.com/thing/1452098/\" target=\"_blank\"><img src=\"http://api.flattr.com/button/flattr-badge-large.png\" alt=\"Flattr this\" title=\"Flattr this\" border=\"0\" /></a>\n=====\n\nA client FTP library for NodeJS that focuses on correctness, clarity\nand conciseness. It doesn't get in the way and plays nice with streaming APIs.\n\n[![NPM](https://nodei.co/npm/jsftp.png)](https://nodei.co/npm/jsftp/)\n\n**Warning: The latest version (1.0.0) of jsftp breaks API compatibility with previous\nversions, it is NOT a drop-in replacement. Please be careful when upgrading. The\nAPI changes are not drastic at all and it is all documented below. If you do not\nwant to upgrade yet you should stay with version 0.6.0, the last one before the\nupgrade. The API docs below are updated for 1.0.**\n\nStarting it up\n--------------\n\n```javascript\nvar JSFtp = require(\"jsftp\");\n\nvar Ftp = new JSFtp({\n host: \"myserver.com\",\n port: 3331, // defaults to 21\n user: \"user\", // defaults to \"anonymous\"\n pass: \"1234\" // defaults to \"@anonymous\"\n};\n```\n\njsftp gives you access to all the raw commands of the FTP protocol in form of\nmethods in the `Ftp` object. It also provides several convenience methods for\nactions that require complex chains of commands (e.g. uploading and retrieving\nfiles, passive operations), as shown below.\n\nWhen raw commands succeed they always pass the response of the server to the\ncallback, in the form of an object that contains two properties: `code`, which\nis the response code of the FTP operation, and `text`, which is the complete\ntext of the response.\n\nRaw (or native) commands are accessible in the form `Ftp.raw[\"command\"](params, callback)`\n\nThus, a command like `QUIT` will be called like this:\n\n```javascript\nFtp.raw.quit(function(err, data) {\n if (err) return console.error(err);\n\n console.log(\"Bye!\");\n});\n```\n\nand a command like `MKD` (make directory), which accepts parameters, looks like this:\n\n```javascript\nFtp.raw.mkd(\"/new_dir\", function(err, data) {\n if (err) return console.error(err);\n\n console.log(data.text); // Show the FTP response text to the user\n console.log(data.code); // Show the FTP response code to the user\n});\n```\n\nAPI and examples\n----------------\n\n#### new Ftp(options)\n - `options` is an object with the following properties:\n\n ```javascript\n {\n host: 'localhost', // Host name for the current FTP server.\n port: 3333, // Port number for the current FTP server (defaults to 21).\n user: 'user', // Username\n pass: 'pass', // Password\n }\n ```\n\nCreates a new Ftp instance.\n\n\n#### Ftp.host\n\nHost name for the current FTP server.\n\n#### Ftp.port\n\nPort number for the current FTP server (defaults to 21).\n\n#### Ftp.socket\n\nNodeJS socket for the current FTP server.\n\n#### Ftp.features\n\nArray of feature names for the current FTP server. It is\ngenerated when the user authenticates with the `auth` method.\n\n#### Ftp.system\n\nContains the system identification string for the remote FTP server.\n\n\n### Methods\n\n#### Ftp.raw.FTP_COMMAND([params], callback)\nAll the standard FTP commands are available under the `raw` namespace. These\ncommands might accept parameters or not, but they always accept a callback\nwith the signature `err, data`, in which `err` is the error response coming\nfrom the server (usually a 4xx or 5xx error code) and the data is an object\nthat contains two properties: `code` and `text`. `code` is an integer indicating\nthe response code of the response and `text` is the response string itself.\n\n#### Ftp.auth(username, password, callback)\nAuthenticates the user with the given username and password. If null or empty\nvalues are passed for those, `auth` will use anonymous credentials. `callback`\nwill be called with the response text in case of successful login or with an\nerror as a first parameter, in normal Node fashion.\n\n#### Ftp.ls(filePath, callback)\nLists information about files or directories and yields an array of file objects\nwith parsed file properties to the `callback`. You should use this function\ninstead of `stat` or `list` in case you need to do something with the individual\nfile properties.\n\n```javascript\nftp.ls(\".\", function(err, res) {\n res.forEach(function(file) {\n console.log(file.name);\n });\n});\n```\n\n#### Ftp.list(filePath, callback)\nLists `filePath` contents using a passive connection. Calls callback with an\narray of strings with complete file information.\n\n```javascript\nftp.list(remoteCWD, function(err, res) {\n res.forEach(function(file) {\n console.log(file.name);\n });\n // Prints something like\n // -rw-r--r-- 1 sergi staff 4 Jun 03 09:32 testfile1.txt\n // -rw-r--r-- 1 sergi staff 4 Jun 03 09:31 testfile2.txt\n // -rw-r--r-- 1 sergi staff 0 May 29 13:05 testfile3.txt\n // ...\n});\n```\n\n#### Ftp.get(remotePath, callback)\nGives back a paused socket with the file contents ready to be streamed,\nor calls the callback with an error if not successful.\n\n```javascript\n var str = \"\"; // Will store the contents of the file\n ftp.get('remote/path/file.txt', function(err, socket) {\n if (err) return;\n\n socket.on(\"data\", function(d) { str += d.toString(); })\n socket.on(\"close\", function(hadErr) {\n if (hadErr)\n console.error('There was an error retrieving the file.');\n });\n socket.resume();\n });\n```\n\n#### Ftp.get(remotePath, localPath, callback)\nStores the remote file directly in the given local path.\n\n```javascript\n ftp.get('remote/file.txt, 'local/file.txt, function(hadErr) {\n if (hadErr)\n console.error('There was an error retrieving the file.');\n else\n console.log('File copied successfully!');\n });\n```\n\n#### Ftp.put(source, remotePath, callback)\nUploads a file to `filePath`. It accepts a string with the local path for the\nfile or a `Buffer` as a `source` parameter.\n\n```javascript\nftp.put(buffer, 'path/to/remote/file.txt', function(hadError) {\n if (!hadError)\n console.log(\"File transferred successfully!\");\n});\n```\n\n#### Ftp.rename(from, to, callback)\nRenames a file in the server. `from` and `to` are both filepaths.\n\n```javascript\nftp.rename(from, to, function(err, res) {\n if (!err)\n console.log(\"Renaming successful!\");\n});\n```\n\n#### Ftp.keepAlive()\nRefreshes the interval thats keep the server connection active.\n\nYou can find more usage examples in the [unit tests](https://github.com/sergi/jsftp/blob/master/test/jsftp_test.js). This documentation\nwill grow as jsftp evolves.\n\nInstallation\n------------\n\n npm install jsftp\n\nTest coverage\n-------------\n\nIn order to run coverage reports:\n\n npm install --dev\n make coverage\n\n Current overall coverage rate:\n lines......: 92.1% (316 of 343 lines)\n functions..: 91.0% (71 of 78 functions)\n\n\nTests\n-----\n\nTo run tests:\n\n npm install --dev\n make test\n\nLicense\n-------\n\nSee LICENSE.\n",
"_id": "jsftp@1.1.1",
"dist": {
"shasum": "7947db8de04c8ea1a035451c1a8b6bcaa5b0d2d5"
},
"_from": "jsftp"
}