{"_id":"@ekliptor/easy-ftp","_rev":"2-56c25b913a24fe78e313d657340e36de","name":"@ekliptor/easy-ftp","dist-tags":{"latest":"0.4.2"},"versions":{"0.4.1":{"name":"@ekliptor/easy-ftp","version":"0.4.1","description":"easy ftp and sftp","main":"main.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["ftp","sftp","ssh","tls","ftps","upload","remote","download"],"dependencies":{"easy-loop":"^1.7.2","fs-extra":"^9.0.1","ftp-simple":"^0.3.1","ssh2":"^0.8.9"},"repository":{"type":"git","url":"git+https://github.com/humy2833/easy-ftp.git"},"bugs":{"url":"https://github.com/humy2833/easy-ftp/issues"},"author":{"name":"humy2833","email":"humy2833@gmail.com"},"license":"MIT","gitHead":"47a96983f272e7229b74c8d7c4b5c5c36bdd539f","homepage":"https://github.com/humy2833/easy-ftp#readme","_id":"@ekliptor/easy-ftp@0.4.1","_nodeVersion":"14.4.0","_npmVersion":"6.14.4","dist":{"integrity":"sha512-7UuQIuNrfe5mEqXte8jelH4VrtJ1GNFXlQwe0hXKdgEyGt+sUqM7Cwx7BLozPPY3Qwhtc82aJpX5Jued3CQsCg==","shasum":"8cbabfd76b4e69f92d175bccdd7b036c89d31913","tarball":"https://registry.npmjs.org/@ekliptor/easy-ftp/-/easy-ftp-0.4.1.tgz","fileCount":13,"unpackedSize":46531,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe9higCRA9TVsSAnZWagAAVJMP/i4pBkajvLtSgzIQHnrC\nHlV4KvJFrmd0MBFom+CCwM8eGWWhiJ9DVGvAQEZnqYkEqy07G3V3f73D3P/T\nIr8bzL5eeHXX91cnxUIZgWJ4TAU+n1iezyiUBba94uOYVc3f+Y6BAF/+TdNa\nKQFmrtXBRx9lMtx8wd6MIcpedo+GBIUNv6ZKaRilxVSD6gV6/XP1+uY6yayH\nlEOjDBWzBQczUbtU/HyteycoQkEM5rr7oKIdIcSVedjvvXFJhOyP9AhzAe9y\nZ6BfKY2sZahFfsMKe0nwSOneR9I4skRthkkS+dVvknGPDJOxgbfpRW6WtUiX\ne4sOSoy6TaYnk4jo3um+QDDNYycsmjApuYVJsEwVN3ndNZiXF0fT7+5cmL+9\nHtcNuyeiG8DBRcxjAedTxdSjn18Q0rPPX7KSkf0hcPJ1sIKanrBsYk9IZ2N0\niQTM1q/35ikJQI5qVg25+vWRZUHG6Sh7rCB2zsKa7U6xzMqP35PHELONhmlI\nXfLjZAdBTkqrkrkmRj769SA7PzxwdjYqDtd28+KLq1ObSIcuWasIF8cdc9Vq\n/0idQMIZQe5dnJpD3gzPuB1gua09DhEMAFgcXBqSjDBO6pXl77Wy9VVSiEmj\nKr19chg1sSzpW/F5dSFWjLEGBoWSNiMbLyRSjF9jiYiz5cN3kGnFApftSrSi\nCm7k\r\n=9Gg7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDW/bEtbNNaS8QFpVJLU2k3yYgBv8XuRjKV6jdgv1acxAIgWHMmUjM+tyslQ1/S0Ce9mr55B3yY3y04j/M6SEs7xXc="}]},"maintainers":[{"name":"ekliptor","email":"Ekliptor1@yandex.com"}],"_npmUser":{"name":"ekliptor","email":"Ekliptor1@yandex.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/easy-ftp_0.4.1_1593186463553_0.9688680767901572"},"_hasShrinkwrap":false},"0.4.2":{"name":"@ekliptor/easy-ftp","version":"0.4.2","description":"easy ftp and sftp","main":"main.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["ftp","sftp","ssh","tls","ftps","upload","remote","download"],"dependencies":{"easy-loop":"^1.7.2","fs-extra":"^9.0.1","@ekliptor/ftp-simple":"0.7.5","ssh2":"^0.8.9"},"repository":{"type":"git","url":"git+https://github.com/humy2833/easy-ftp.git"},"bugs":{"url":"https://github.com/humy2833/easy-ftp/issues"},"author":{"name":"humy2833","email":"humy2833@gmail.com"},"license":"MIT","_id":"@ekliptor/easy-ftp@0.4.2","dist":{"shasum":"9b2d030b3df50364d4856944d36bcadbe662bf4e","integrity":"sha512-/p9UlrYtneb4xh1A+rbsbL9cpanLrhlDJez/EelDwRTZr6ZlyPRzNN3mgEaKxRs3d7Q31jxVP23sYj/pdO+0wg==","tarball":"https://registry.npmjs.org/@ekliptor/easy-ftp/-/easy-ftp-0.4.2.tgz","fileCount":17,"unpackedSize":46743,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe9injCRA9TVsSAnZWagAAaJIP/1Cf/Qpe2bsxdbPwC15L\nNckjlbnCKFkzDalAy274cKeALS3DRxQsuzesiYPGyJ7VBcybHpDa5VzRuujo\n1WufqHBESrg2fCwGnbLI50IHL+AousEFwMzOQE1Q3tl5uJP4+PsjkaRk1NYe\n/NxOvMu71pFBMYQ+KRa0rcgfW3q8Xsvd46mXO8IPWc5TF2YXht2bLPXjKnBz\nH2t8owOhmyjTkRqkTH7shvyhTX9naCmyDh1y5y9r4DTRT0KHDx25fXdSKYRS\nEggZmmXhEtSeok/8uHvV/3oxu8fQNTrbjfhyaMr3V/wuU7bfxx8MEul+uIFv\nkZShr7hMaaZc5XXt4AmA7uLLxL8AQw+gduI6UPQjg62DSHSz2GH7KGS+wKuT\n4SiwDQd5CIMi+Xuuvd80lPAZAx9QZEXGqPTuD+m39XWJzHh70deDaw0zOgR9\n5Qpt7T08RA5Qr28poUllKO9GFcjlcjqdlBUpx+xldC0iiwb/+gfvD1NjnFVF\nLvKUnmp8oH+DqaUvb3hyHZe2OsFWiwSHkEuh2N2rRonqlvoE7b0dglk2f+0q\nLRNIG9EGpdvFRGSDBj0ex3sHScVvfw9IQDfcw2TocJ6gDx+2isGuu36YZpuo\nDF8i7uPMzAX/5y/oLQEoeZJdfz8MUcWoYu9JQtSVK4WX/V/Ps+Fc1VswTBsH\n9ujK\r\n=R15B\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEuuVff2egDKMbaC8BIyxVdLZtXtrm2+gcoMQ5vRZCJpAiEAwEwGKf1FDCjPEdCnqdERBuaGTdGMRec4letFvm7qEoU="}]},"maintainers":[{"name":"ekliptor","email":"Ekliptor1@yandex.com"}],"_npmUser":{"name":"ekliptor","email":"Ekliptor1@yandex.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/easy-ftp_0.4.2_1593190882518_0.8313149751235214"},"_hasShrinkwrap":false}},"time":{"created":"2020-06-26T15:47:43.552Z","0.4.1":"2020-06-26T15:47:43.727Z","modified":"2022-04-05T07:02:42.962Z","0.4.2":"2020-06-26T17:01:22.732Z"},"maintainers":[{"name":"ekliptor","email":"Ekliptor1@yandex.com"}],"description":"easy ftp and sftp","keywords":["ftp","sftp","ssh","tls","ftps","upload","remote","download"],"repository":{"type":"git","url":"git+https://github.com/humy2833/easy-ftp.git"},"author":{"name":"humy2833","email":"humy2833@gmail.com"},"bugs":{"url":"https://github.com/humy2833/easy-ftp/issues"},"license":"MIT","readme":"easy-ftp\n===========\n- Easy control FTP or SFTP\n- 간단한 설정만으로 편리하게 FTP 혹은 SFTP 의 기능을 이용할 수 있습니다.\n- 이 모듈은 [ftp-simple](https://www.npmjs.com/package/ftp-simple) 와 [ssh2](https://www.npmjs.com/package/ssh2) 모듈을 참조하였습니다.\n\nCaution\n===========\nIf Node.js version is 8 or higher, use `0.4.0` or higher. Otherwise, use version `0.3.44`.\n\n\nInstall\n=======\nIf Node.js version is 8 or higher.\n    \n    npm install easy-ftp\n\nOtherwise\n    \n    npm install easy-ftp@0.3.44\n\n\n\n\nUsage\n===========\n```javascript\nvar EasyFtp = require('easy-ftp');\nvar ftp = new EasyFtp();\nvar config = {\n    host: '',\n    port: 21,\n    username: '',\n    password: '',\n    type : 'ftp'\n};\n\n//서버 접속(connect)\nftp.connect(config);\t\t\n\n//폴더 변경(directory change)\nftp.cd(\"/\", function(err, path){});\t\n\n//파일 or 폴더 삭제(하위 파일 및 폴더 포함)(file or directory remove(recursive))\nftp.rm(\"/filename\", function(err){});\t\n\n//폴더 생성(하위 폴더 포함 생성)(make directory)\nftp.mkdir(\"/directory\", function(err){});\t\n\n//파일 or 폴더 이동 혹은 이름 변경(file or directory move or change filename)\nftp.mv(\"/filename\", \"/newFilename\", function(err, newPath){});\t\n\n//폴더 내 파일목록 반환(show files in directory)\nftp.ls(\"/directory\", function(err, list){});\t\n\n//ftp 서버상의 현재 작업 경로 반환(return server path)\nftp.pwd(function(err, path){});\t\n\n//서버에 파일이 존재하는지 여부 반환(boolean)\nftp.exist(\"/filename\", function(exist){});\n\n\n//파일 or 폴더 업로드(file or directory upload)\nftp.upload(\"/test.txt\", \"/test.txt\", function(err){});  \t//result => /test.txt\nftp.upload(\"/test.txt\", \"/test123.txt\", function(err){});  //result => /test123.txt \nftp.upload(\"/test.txt\", \"/\", function(err){});\t\t\t//result => /test.txt\nftp.upload(\"/directory\", \"/\", function(err){});\t\t\t//result => /directory\n\n//Array - Object({local:'localPath', remote:'remotePath'})\nvar arr = [{local:\"/test.txt\", remote:\"/test.txt\"}, {local:\"/test1.txt\", remote:\"/abcd/test2.txt\"}, {local:\"/directory\", remote:\"/\"}];\nftp.upload(arr, function(err){});\t// 2 arguments;\n/* result\n/test.txt\n/abcd/test2.txt\n/directory\n*/\n\n//Array - String\nvar arr = [\"/test.txt\", \"/abcd/test2.txt\", \"/directory\"];\nftp.upload(arr, \"/\", function(err){});\t// 3 arguments;\n/* result\n/test.txt\n/abcd/test2.txt\n/directory\n*/\n\n//Array - Object and String\nvar arr = [{local:\"/test.txt\", remote:\"/directory/test.txt\"}, \"/abcd/test2.txt\", \"/directory\"];\nftp.upload(arr, \"/\", function(err){});\t// 3 arguments;\n/* result\n/directory/test.txt\n/abcd/test2.txt\n/directory\n*/\n\n\n//파일 or 폴더 다운로드(file or directory download)\nftp.download(\"/test.txt\", \"/test.txt\", function(err){});\t//result => /test.txt\nftp.download(\"/test.txt\", \"/test123.txt\", function(err){});\t//result => /test123.txt \nftp.download(\"/test.txt\", \"/\", function(err){});\t\t//result => /test.txt \nftp.download(\"/directory\", \"/\", function(err){});\t\t//result => /directory \n\n//Array - Object({local:'localPath', remote:'remotePath'})\nvar arr = [{remote:\"/test.txt\", local:\"/test.txt\"}, {remote:\"/test1.txt\", local:\"/abcd/test2.txt\"}, {remote:\"/directory\", local:\"/\"}];\nftp.download(arr, function(err){});\t// 2 arguments;\n/* result\n/test.txt\n/abcd/test2.txt\n/directory\n*/\n\n//Array - String\nvar arr = [\"/test.txt\", \"/abcd/test2.txt\", \"/directory\"];\nftp.download(arr, \"/\", function(err){});\t// 3 arguments;\n/* result\n/test.txt\n/abcd/test2.txt\n/directory\n*/\n\n//Array - Object and String\nvar arr = [{remote:\"/test.txt\", local:\"/directory/test.txt\"}, \"/abcd/test2.txt\", \"/directory\"];\nftp.download(arr, \"/\", function(err){});\t// 3 arguments;\n/* result\n/directory/test.txt\n/abcd/test2.txt\n/directory\n*/\n\n\n\n//접속 종료(disconnect)\nftp.close();\t\n```\n\n\n\nAPI\n===========\nMethods\n-------\n* **connect**(< _object_ >config) \n\n    * host - _string_\t- server domain or ip **Default:** 'localhost'\n    * port - _number_\t- port (default : 21)\n    * type - _string_\t- ftp type. 'ftp' or 'sftp' (default : 'ftp')\n    * username - _string_ - username for authentication **Default:** 'anonymous',\n    * password - _string_\t- password for authentication. **Default:** 'anonymous@'\n    * privateKey - _string_\t- (only sftp)string that contains a private key for either key-based or hostbased user authentication (OpenSSH format) **Default:** none\n    * path - _string_\t- start path.\n    * secure - _boolean_ - (only ftp) Explicit FTPS over TLS, default: false\n    * secureOptions - _object_ - (only ftp) Options for TLS, same as for `tls.connect()` in Node.js.\n\n\n* **cd**(< _string_ >path, < _function_ >callback) - Changes the working directory. callback has 1 parameter: < Error >err.\n\n* **rm**(< _string_ >path, < _function_ >callback) - Deletes a file or directory(include child files) path on the server. callback has 1 parameter: < Error >err.\n    \n* **mkdir**(< _string_ >path, < _function_ >callback) - Creates a new directory recursive. callback has 1 parameter: < Error >err.\n\n* **mv**(< _string_ >oldPath, < _string_ >newPath, < _function_ >callback) - Renames or Move oldPath to newPath on the server. callback has 2 parameter: < Error >err, < String >newPath.\n\n* **ls**(< _string_ >path, < _function_ >callback) - Retrieves the directory listing of path. callback has 2 parameter: < Error >err, < Array >list.\n    \n    * name - _string_ - file name\n    * size - _number_ - file size\n    * type - _string_ - file type. 'd' => directory,  'f' => file\n    * date - _date_ - file last modified date\n\n\n* **pwd**(< _function_ >callback) - Retrieves the current working directory. callback has 2 parameters: < Error >err, < string >cwd.\n\n* **exist**(< _function_ >callback) - whether a file or direcotry exists. callback has 1 parameters: < boolean >exist.\n\n* **upload**(< _mixed_ >localPath, < _string_ >remotePath, < _function_ >callback) - Sends data to the server to be stored as remotePath. If direcotry path, include self directory and child files. If you want only child files, localPath is \"/directory/**\". callback has 1 parameter: < Error >err. \n    \n    * file\t\t- ex) upload(\"/test.txt\", \"/a/b/test.txt\", ...)\t=>  result : /a/b/test.txt\n    * directory\t\t- ex) upload(\"/directory\", \"/a/b\", ...)\t\t=>  result : /a/b/directory\n    * only child files\t- ex) upload(\"/directory/**\", \"/a/b\", ...)\t=>  result : /a/b/child files...\n    * array\t- ex) upload([\"/directory/**\", \"/test.txt\"], \"/a/b\", ...)\t=>  result : \"/a/b/test.txt\" and \"/a/b/child files...\"\n\n\n* **download**(< _mixed_ >remotePath, < _string_ >localPath, < _function_ >callback) - Retrieves a file or directory at path from the server. If directory path, include child files. callback has 1 parameter: < Error >err. \n\n\t* file\t\t- ex) download(\"/test.txt\", \"/a/b/test.txt\", ...)\t=>  result : /a/b/test.txt\n    * directory\t\t- ex) download(\"/directory\", \"/a/b\", ...)\t\t=>  result : /a/b/directory\n    * only child files\t- ex) download(\"/directory/**\", \"/a/b\", ...)\t=>  result : /a/b/child files...\n    * array\t- ex) download([\"/directory/**\", \"/test.txt\"], \"/a/b\", ...)\t=>  result : \"/a/b/test.txt\" and \"/a/b/child files...\"\n    \n\n* **close**() - Closes the connection to the server after any/all enqueued commands have been executed.\n\n\n\n\nEvent\n-------\n* **open**(< _FTPClient_ >client) - Emitted when connection and authentication were sucessful.\n\n* **close** - Emitted when the connection has fully closed.\n\n* **error**(< _Error_ >err) - Emitted when the connection has fully closed.\n\n* **upload**(< _string_ >uploadedRemotePath) - Emitted when file or directory uploaded.\n\n* **uploading**(< _object_ >data) - (sftp only) Emitted when file was transferred.\n\n* **download**(< _string_ >downloadedLocalPath) - Emitted when file or directory downloaded.\n\n* **downloading**(< _object_ >data) - (sftp only) Emitted when file was transferred.\n\n\n\nExamples\n===========\n```javascript\n//Connect\nvar ftp = new EasyFTP();\nvar config = {\n    host: 'localhost',\n    port: 21,\n    username: 'id',\n    password: 'password',\n    type : 'ftp'\n};\nftp.connect(config);\n\n\n\n\n/* \nEx) Directory structure\n/test/test.txt\n/test/child1\n/test/child1/image.png\n/test/child1/child2\n/test/child1/child2/shell.sh\n*/\n\n//Case1. files Upload\nvar ftp = new EasyFTP();\nftp.connect({...});\n//\"/test/test.txt\", \"/test.txt\"   or   \"/test/test.txt\", \"/\"\nftp.upload(\"/test/test.txt\", \"/test.txt\", function(err){\n\tftp.close();\n});\n/* result\n/test.txt\n*/\n\n\n\n//Case2. child files Upload\nvar ftp = new EasyFTP();\nftp.connect({...});\n// '/test/**' or '/test/*'\nftp.upload(\"/test/**\", \"/\", function(err){\n\tftp.close();\n});\n/* result\n/test.txt\n/child1\n/child1/image.png\n/child1/child2\n/child1/child2/shell.sh\n*/\n\n\n\n//Case3. directory Upload\nvar ftp = new EasyFTP();\nftp.connect({...});\nftp.upload(\"/test\", \"/\", function(err){\n\tftp.close();\t\n});\n/* result\n/test/test.txt\n/test/child1\n/test/child1/image.png\n/test/child1/child2\n/test/child1/child2/shell.sh\n*/\n\n//Case4. Multi file Upload\n//Array - Object({local:'localPath', remote:'remotePath'})\nvar arr = [{local:\"/test.txt\", remote:\"/test.txt\"}, {local:\"/test1.txt\", remote:\"/abcd/test2.txt\"}, {local:\"/directory\", remote:\"/\"}];\nftp.upload(arr, function(err){ftp.close();});\t// 2 arguments;\n/* result\n/test.txt\n/abcd/test2.txt\n/directory\n*/\n\n//Array - String\nvar arr = [\"/test.txt\", \"/abcd/test2.txt\", \"/directory\"];\nftp.upload(arr, \"/\", function(err){ftp.close();});\t// 3 arguments;\n/* result\n/test.txt\n/abcd/test2.txt\n/directory\n*/\n\n//Array - Object and String\nvar arr = [{local:\"/test.txt\", remote:\"/directory/test.txt\"}, \"/abcd/test2.txt\", \"/directory\"];\nftp.upload(arr, \"/\", function(err){ftp.close();});\t// 3 arguments;\n/* result\n/directory/test.txt\n/abcd/test2.txt\n/directory\n*/\n\n\n\n//Case5. file download\nvar ftp = new EasyFTP();\nftp.connect({...});\n//\"/test/test.txt\", \"/test.txt\"   or   \"/test/test.txt\", \"/\"\nftp.download(\"/test/test.txt\", \"/test.txt\", function(err){\n\tftp.close();\t\n});\n/* result\n/test.txt\n*/\n\n\n\n//Case6. direcotry download\nvar ftp = new EasyFTP();\nftp.connect({...});\nftp.download(\"/test\", \"/\", function(err){\n\tftp.close();\t\n});\n/* result\n/test/test.txt\n/test/child1\n/test/child1/image.png\n/test/child1/child2\n/test/child1/child2/shell.sh\n*/\n\n\n\n//Case7. Multi file download\n//Array - Object({local:'localPath', remote:'remotePath'})\nvar arr = [{remote:\"/test.txt\", local:\"/test.txt\"}, {remote:\"/test1.txt\", local:\"/abcd/test2.txt\"}, {remote:\"/directory\", local:\"/\"}];\nftp.download(arr, function(err){ftp.close();});\t// 2 arguments;\n/* result\n/test.txt\n/abcd/test2.txt\n/directory\n*/\n\n//Array - String\nvar arr = [\"/test.txt\", \"/abcd/test2.txt\", \"/directory\"];\nftp.download(arr, \"/\", function(err){ftp.close();});\t// 3 arguments;\n/* result\n/test.txt\n/abcd/test2.txt\n/directory\n*/\n\n//Array - Object and String\nvar arr = [{remote:\"/test.txt\", local:\"/directory/test.txt\"}, \"/abcd/test2.txt\", \"/directory\"];\nftp.download(arr, \"/\", function(err){ftp.close();});\t// 3 arguments;\n/* result\n/directory/test.txt\n/abcd/test2.txt\n/directory\n*/\n```\n","readmeFilename":"README.md"}