
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
nestjs-basic-ftp
Advanced tools
npm install nestjs-basic-ftp
Originally forked but recast from https://github.com/AbdessalemLetaief/nestjs-ftp package
And extend the library https://github.com/patrickjuchli/basic-ftp
This is an FTP client for NestJs, it supports FTPS over TLS, Passive Mode over IPv6, has a Promise-based API, and offers methods to operate on whole directories built on top of basic-ftp.
Nestjs-basic-ftp is build using the NestJs Dynamic modules and Factory providers approach, to configure it import the FtpModule
module and the forRootFtpAsync
service.
For example, your AppModule
should look like this :
import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config'
import { FtpModule } from 'nestjs-basic-ftp';
@Module({
imports: [
ConfigModule,
FtpModule.forRootFtpAsync({
useFactory: async (config: ConfigService) => {
return {
host: config.get<string>('FTP_URL'),
port: config.get<number>('FTP_PORT'),
user: config.get<string>('FTP_USER'),
password: config.get<string>('FTP_PASS'),
secure: config.get<boolean>('FTP_SECURE'),
verbose: true, // example, may not be declared
availableListCommands: ['LIST -a', 'LIST'], // example, may not be declared
};
},
imports: [ConfigModule],
inject: [ConfigService],
}),
],
providers: [],
controllers: [],
})
export class AppModule {}
Then just inject the service just like any local service
For Example:
import { Injectable, ServiceUnavailableException, Logger } from '@nestjs/common';
import { FtpService } from 'nestjs-basic-ftp';
@Injectable()
export class AppService {
private logger = new Logger('AppService', { timestamp: true });
constructor(private readonly _ftpService: FtpService){}
public async listingFile(): Promise<FileInfo[]> {
try {
const fileList = await this._ftpService.list();
return fileList;
} catch (e) {
this.logger.error(JSON.stringify(e));
throw new ServiceUnavailableException(e);
}
}
}
Licensed under the MIT License - see the LICENSE file for details.
FAQs
Simple 'basic-ftp' wrapper for NestJs
The npm package nestjs-basic-ftp receives a total of 199 weekly downloads. As such, nestjs-basic-ftp popularity was classified as not popular.
We found that nestjs-basic-ftp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.