Search code examples
javascriptnode.jssftpftps

SFTP-Nodejs create folder in remote location


I had used the following node module for sftp implementation.

https://www.npmjs.com/package/ftps

My target is to create a folder in the remote location and save my file. In the see the available session( http://lftp.yar.ru/lftp-man.html) in the documentation it shows mkdir as an option. But I have no idea how to use it. Kindly help me create a folder in remote location. I am new to server development and this confuses me. Or is it possible to create a folder?


Solution

  • Just adding the following lines to index.js of node modules worked.

    FTP.prototype.mkdir = function (directory , mode) {
        return this.raw('mkdir '+mode+' '+directory)
     };
    

    The function call in the program is as follows

     ftps.mkdir(path,['-p']).cd(path).addFile(file);