Gathering detailed insights and metrics for nest-sftp
Gathering detailed insights and metrics for nest-sftp
Gathering detailed insights and metrics for nest-sftp
Gathering detailed insights and metrics for nest-sftp
@types/ssh2-sftp-client
TypeScript definitions for ssh2-sftp-client
ssh2
SSH2 client and server modules written in pure JavaScript for node.js
@nestjs/common
Nest - modern, fast, powerful node.js web framework (@common)
@nestjs/core
Nest - modern, fast, powerful node.js web framework (@core)
npm install nest-sftp
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
13 Stars
130 Commits
15 Forks
3 Watching
2 Branches
2 Contributors
Updated on 25 Oct 2024
TypeScript (96.64%)
JavaScript (3.36%)
Cumulative downloads
Total Downloads
Last day
-17.7%
405
Compared to previous day
Last week
-7.9%
2,763
Compared to previous week
Last month
-9.2%
13,604
Compared to previous month
Last year
-9.9%
160,744
Compared to previous year
1
2
33
This is nest-sftp.
Nest framework module wrapper around ssh2-sftp-client
1$ npm install --save nest-sftp
Register the SftpModule in you App Module.
This version uses forRootAsync
1import { SftpModule } from 'nest-sftp'; 2 3@Module({ 4 imports: [ 5 SftpModule.forRootAsync( 6 { 7 useFactory: (configService: ConfigService) => { 8 return configService.getSftpConnectionInfo(); 9 }, 10 inject: [ConfigService], 11 imports: [AppModule], 12 }, 13 false, 14 ), 15 ], 16 controllers: [], 17 providers: [ConfigService], 18 exports: [ConfigService], 19}) 20export class AppModule {}
The Options object implements the ConnectConfig from ssh2.
1import { SftpModule } from 'nest-sftp'; 2 3@Module({ 4 imports: [ 5 SftpModule.forRoot( 6 { 7 host: 'fakehost.com', 8 port: 22, 9 username: 'fakeUser', 10 password: '*****', // passwords should not contain \ (thy should be espaced like \\) and they cannot contain ! or ( 11 }, 12 false, 13 ), 14 ], 15 controllers: [], 16 providers: [], 17}) 18export class AppModule {}
With debug logging:
1import { SftpModule } from 'nest-sftp'; 2 3@Module({ 4 imports: [ 5 SftpModule.forRoot( 6 { 7 host: 'fakehost.com', 8 port: 22, 9 username: 'fakeUser', 10 password: '*****', // passwords should not contain \ (thy should be espaced like \\) and they cannot contain ! or ( 11 debug: console.log, // adds logging for researching problems 12 }, 13 false, 14 ), 15 ], 16 controllers: [], 17 providers: [], 18}) 19export class AppModule {}
The SftpModule is global. The forRoot() method will open the connection as well during AppModule registration. Then the SftpClientService can be injected into your class.
1import { SftpClientService } from 'nest-sftp'; 2 3export class AppService { 4 private readonly logger: Logger; 5 constructor(private readonly sftpClient: SftpClientService) { 6 logger = new Logger(); 7 } 8 9 async download( 10 remotePath: string, 11 localPath: string, 12 ): Promise<string | NodeJS.ReadableStream | Buffer> { 13 return await this.sftpClient.download(remotePath, localPath); 14 } 15 // change connection to a different user/password prior to upload 16 async submit( 17 remotePath: string, 18 localPath: string, 19 submitConfig: ConnectConfig, 20 ): Promise<string | NodeJS.ReadableStream | Buffer> { 21 await this.sftpClient.resetConnection(submitConfig); 22 return await this.sftpClient.upload(remotePath, localPath); 23 } 24}
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
Nest SFTP is MIT licensed.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
8 existing vulnerabilities detected
Details
Reason
Found 1/12 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More