Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
ftp-library
Advanced tools
A lightweight Node.js FTP server library built from scratch. Fully compliant with RFC 959, it supports custom configurations, directory listings, authentication, and more. Perfect for developers needing a robust FTP server for testing, development, or lig
A lightweight FTP server library for Node.js. Fully compliant with RFC 959, this library is designed to be fast, reliable, and customizable. It is ideal for developers needing an FTP server for development, testing, or lightweight production use.
CWD
, MKD
, RMD
, STAT
, and HELP
for enhanced functionality.npm install js-ftp-server
const { FTPServer } = require('js-ftp-server');
const server = new FTPServer({ port: 2121 });
server.start();
const { FTPServer } = require('ftp-library');
const server = new FTPServer({ port: 2121 });
server.start();
const { FTPServer } = require('ftp-library');
const server = new FTPServer({ port: 2121, host: '127.0.0.1' });
server.start();
const { FTPServer } = require('ftp-library');
const server = new FTPServer({ allowAnonymous: true });
server.start();
const { FTPServer } = require('ftp-library');
const server = new FTPServer({ rootDir: '/var/ftp' });
server.start();
const { FTPServer } = require('ftp-library');
const { validateCredentials } = require('./src/utils');
const server = new FTPServer();
server.handleConnection = (socket) => {
socket.write('220 Welcome to the custom FTP server\r\n');
socket.on('data', (data) => {
const command = data.toString().trim();
if (command.startsWith('USER admin') && validateCredentials('admin', 'password')) {
socket.write('230 User logged in, proceed\r\n');
} else {
socket.write('530 Login incorrect\r\n');
}
});
};
server.start();
const { FTPServer } = require('ftp-library');
const fs = require('fs');
const path = require('path');
const server = new FTPServer();
server.handleConnection = (socket) => {
socket.on('data', (data) => {
const command = data.toString().trim();
if (command.startsWith('STOR')) {
const fileName = command.split(' ')[1];
const writeStream = fs.createWriteStream(path.join(server.rootDir, fileName));
socket.pipe(writeStream);
socket.write('226 Transfer complete\r\n');
}
});
};
server.start();
const { FTPServer } = require('ftp-library');
const fs = require('fs');
const path = require('path');
const server = new FTPServer();
server.handleConnection = (socket) => {
socket.on('data', (data) => {
const command = data.toString().trim();
if (command.startsWith('RETR')) {
const fileName = command.split(' ')[1];
const readStream = fs.createReadStream(path.join(server.rootDir, fileName));
readStream.pipe(socket);
socket.write('226 Transfer complete\r\n');
}
});
};
server.start();
const { FTPServer } = require('ftp-library');
const server = new FTPServer();
server.handleConnection = (socket) => {
socket.on('data', (data) => {
const command = data.toString().trim();
if (command.startsWith('PASV')) {
socket.write('227 Entering Passive Mode (127,0,0,1,192,168)\r\n');
}
});
};
server.start();
const { FTPServer } = require('ftp-library');
const server = new FTPServer();
server.handleConnection = (socket) => {
socket.on('data', (data) => {
console.log(`Command received: ${data.toString().trim()}`);
socket.write('502 Command not implemented\r\n');
});
};
server.start();
const { FTPServer } = require('ftp-library');
const server = new FTPServer();
server.handleConnection = (socket) => {
socket.write('220 Welcome to My Custom FTP Server\r\n');
};
server.start();
const { FTPServer } = require('ftp-library');
const server = new FTPServer();
server.handleConnection = (socket) => {
console.log('New connection established');
socket.write('220 Ready\r\n');
};
server.start();
const { FTPServer } = require('ftp-library');
const fs = require('fs');
const server = new FTPServer();
server.handleConnection = (socket) => {
socket.on('data', (data) => {
const command = data.toString().trim();
if (command.startsWith('RNFR')) {
const oldName = command.split(' ')[1];
socket.once('data', (newData) => {
const newName = newData.toString().trim().split(' ')[1];
fs.renameSync(oldName, newName);
socket.write('250 File renamed\r\n');
});
}
});
};
server.start();
const { FTPServer } = require('ftp-library');
const fs = require('fs');
const server = new FTPServer();
server.handleConnection = (socket) => {
socket.on('data', (data) => {
const command = data.toString().trim();
if (command.startsWith('DELE')) {
const fileName = command.split(' ')[1];
fs.unlinkSync(fileName);
socket.write('250 File deleted\r\n');
}
});
};
server.start();
const { FTPServer } = require('ftp-library');
const server = new FTPServer();
server.handleConnection = (socket) => {
socket.on('data', (data) => {
const command = data.toString().trim();
if (command === 'MYCMD') {
socket.write('200 Custom command executed\r\n');
}
});
};
server.start();
const { FTPServer } = require('ftp-library');
const fs = require('fs');
const logStream = fs.createWriteStream('./ftp-commands.log', { flags: 'a' });
const server = new FTPServer();
server.handleConnection = (socket) => {
socket.on('data', (data) => {
const command = data.toString().trim();
logStream.write(`${new Date().toISOString()} - ${command}\n`);
socket.write('502 Command not implemented\r\n');
});
};
server.start();
MIT
FAQs
A lightweight Node.js FTP server library built from scratch. Fully compliant with RFC 959, it supports custom configurations, directory listings, authentication, and more. Perfect for developers needing a robust FTP server for testing, development, or lig
The npm package ftp-library receives a total of 0 weekly downloads. As such, ftp-library popularity was classified as not popular.
We found that ftp-library demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.