Socket
Socket
Sign inDemoInstall

nestjs-ftp

Package Overview
Dependencies
205
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nestjs-ftp

Nestjs-ftp is a NestJs Module repository of basic-ftp package


Version published
Weekly downloads
390
decreased by-18.24%
Maintainers
1
Install size
10.5 MB
Created
Weekly downloads
 

Readme

Source

Nest Logo

A NESTJS MODULE FOR FTP

Installation

Installation

npm install nestjs-ftp

About nestjs-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

Quick Start

Nestjs-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';



@Module({
    imports: [
        FtpModule.forRootFtpAsync({
            useFactory : async ()=>{
                return {
                  host:"test.rebex.net",
                  password:"password",
                  port:21,
                  user:"demo",
                  secure:true
                }
            },
            inject: [ConfigService]
        })
  controllers: [AppController],
  providers: [AppService],
  

})
export class AppModule { }

Then just inject the service just like any local service

For Example:

import { Injectable } from '@nestjs/common';
import { FtpService } from 'nestjs-ftp';

@Injectable()
export class AppService {
    constructor(private readonly _ftpService: FtpService){}

    async uploadFile(): string {
        try {
            await this._ftpService.upload(source,destination)
        } catch (error) {
            throw new Error(error)
        }
    }
}

Author

ABDESSALEM LETAIEF

License

Licensed under the MIT License - see the LICENSE file for details.

Keywords

FAQs

Last updated on 31 May 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc