nestjs-webdav
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

NestJS WebDAV

NPM Version Package License

Table of Contents

Description

Integrates WebDAV with Nest

Installation

npm install nestjs-webdav webdav

You can also use the interactive CLI

npx nestjs-modules

Examples

WebDAV-CLI

npx webdav-cli --username=username --password=password

NextCloud

docker run \
-e SQLITE_DATABASE=nextcloud \
-e NEXTCLOUD_ADMIN_USER=admin \
-e NEXTCLOUD_ADMIN_PASSWORD=password \
-p 8080:80 \
nextcloud

WebDAVModule.forRoot(options, connection?)

import { Module } from '@nestjs/common';
import { WebDAVModule } from 'nestjs-webdav';
import { AppController } from './app.controller';
 
@Module({
  imports: [
    WebDAVModule.forRoot({
      config: {
        endpoint: 'http://127.0.0.1:1900',
        username: 'username',
        password: 'password',
      },
    }),
    WebDAVModule.forRoot({
      config: {
        endpoint: 'http://localhost:8080/remote.php/dav/files/admin/',
        username: 'admin',
        password: 'password',
      },
    }, 'nextCloud'),
  ],
  controllers: [AppController],
})
export class AppModule {}

WebDAVModule.forRootAsync(options, connection?)

import { Module } from '@nestjs/common';
import { WebDAVModule } from 'nestjs-webdav';
import { AppController } from './app.controller';
 
@Module({
  imports: [
    WebDAVModule.forRootAsync({
      useFactory: () => ({
        config: {
          endpoint: 'http://127.0.0.1:1900',
          username: 'username',
          password: 'password',
        },
      }),
    }),
    WebDAVModule.forRootAsync({
      useFactory: () => ({
        config: {
          endpoint: 'http://localhost:8080/remote.php/dav/files/admin/',
          username: 'admin',
          password: 'password',
        },
      }),
    }, 'nextCloud'),
  ],
  controllers: [AppController],
})
export class AppModule {}

InjectWebDAV(connection?)

import { Controller, Get, } from '@nestjs/common';
import { InjectWebDAV, WebDAV } from 'nestjs-webdav';
 
@Controller()
export class AppController {
  constructor(
    @InjectWebDAV() private readonly webDAV: WebDAV,
    @InjectWebDAV('nextCloud') private readonly nextCloud: WebDAV,
  ) {}
 
  @Get()
  async getHello() {
    return {
      webdavCli: await this.webDAV.getDirectoryContents('/'),
      nextCloud: await this.nextCloud.getDirectoryContents('/'),
    }
  }
}

License

MIT

Package Sidebar

Install

npm i nestjs-webdav

Weekly Downloads

19

Version

1.0.1

License

MIT

Unpacked Size

15.1 kB

Total Files

18

Last publish

Collaborators

  • svtslv