Last active
December 7, 2019 12:06
-
-
Save MinecraftFuns/17992d5d157c1da2e7e330c689a4d6f0 to your computer and use it in GitHub Desktop.
Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import JSFtp from 'jsftp'; | |
const ftp = new JSFtp({ | |
host, | |
port, | |
}); | |
ftp.raw(`user ${user}`, (err, {code}) => { | |
if (err) { | |
throw err; | |
} | |
if (code === 331) { | |
ftp.raw(`pass ${pass}`, (_err, {code}) => { | |
if (_err) { | |
throw _err; | |
} | |
if (code === 230) { | |
ftp.raw('type I', (__err) => { | |
if (__err) { | |
throw __err; | |
} | |
ftp.put(localFilPath, remoteFilePath, (___err) => { | |
if (___err) { | |
throw ___err; | |
} | |
ftp.raw('quit', (____err) => { | |
if (____err) { | |
throw ____err; | |
} else { | |
ftp.destroy(); | |
} | |
}); | |
}) | |
}); | |
} else { | |
throw _err; | |
} | |
}); | |
} else { | |
throw err; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment