Installations
npm install nest-sftp
Developer
benMain
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
Yes
Node Version
20.11.0
NPM Version
10.4.0
Statistics
13 Stars
130 Commits
15 Forks
3 Watching
2 Branches
2 Contributors
Updated on 25 Oct 2024
Languages
TypeScript (96.64%)
JavaScript (3.36%)
Total Downloads
Cumulative downloads
Total Downloads
416,728
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
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Peer Dependencies
2
Dev Dependencies
33
NEST SFTP
This is nest-sftp.
Description
Nest framework module wrapper around ssh2-sftp-client
Installation
1$ npm install --save nest-sftp
Register in AppModule
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 {}
Dependency Inject Service
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}
Support
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.
Stay in touch
- Author - Benjamin Main
- Author - Victor Frank
License
Nest SFTP is MIT licensed.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
8 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986
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
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
Project has not signed or included provenance with any releases.
Details
- Warn: release artifact v3.0.0 not signed: https://api.github.com/repos/benMain/nest-sftp/releases/143885315
- Warn: release artifact v2.0.3 not signed: https://api.github.com/repos/benMain/nest-sftp/releases/109276706
- Warn: release artifact v2.0.2 not signed: https://api.github.com/repos/benMain/nest-sftp/releases/107870261
- Warn: release artifact v2.0.1 not signed: https://api.github.com/repos/benMain/nest-sftp/releases/87941982
- Warn: release artifact v2.0.0 not signed: https://api.github.com/repos/benMain/nest-sftp/releases/87940966
- Warn: release artifact v3.0.0 does not have provenance: https://api.github.com/repos/benMain/nest-sftp/releases/143885315
- Warn: release artifact v2.0.3 does not have provenance: https://api.github.com/repos/benMain/nest-sftp/releases/109276706
- Warn: release artifact v2.0.2 does not have provenance: https://api.github.com/repos/benMain/nest-sftp/releases/107870261
- Warn: release artifact v2.0.1 does not have provenance: https://api.github.com/repos/benMain/nest-sftp/releases/87941982
- Warn: release artifact v2.0.0 does not have provenance: https://api.github.com/repos/benMain/nest-sftp/releases/87940966
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 23 are checked with a SAST tool
Score
1.8
/10
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 MoreOther packages similar to 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)