GithubHelp home page GithubHelp logo

sirmmo / angular-webdav Goto Github PK

View Code? Open in Web Editor NEW

This project forked from esanzgar/angular-webdav

0.0 1.0 0.0 200 KB

Angular service to support WebDAV protocol.

License: Apache License 2.0

JavaScript 15.86% TypeScript 84.14%

angular-webdav's Introduction

angular-webdav

WebDAV library for Angular (ngx). The WebDAV protocol is an extension of the HTTP protocols with extra methods.

Consuming the library

$ yarn add angular-webdav

and then from your Angular AppModule:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

import { WebDAVModule } from 'angular-webdav';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    WebDAVModule,
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
import { Component } from '@angular/core';
import {WebDAV, Header} from 'angular-webdav';

@Component({
  selector: 'my-app',
  template: `<h1>Hello {{name}}</h1>`,
})
export class AppComponent  { name = 'Angular';
    constructor(private webdav: WebDAV){
        const header =  new Headers();
        const url = 'https://your.url'
        header.append('Authorization', 'Basic '  + btoa('username:password'));
        //header.append('Destination', '${url}/newfile_directory');
        //header.append('Depth', '300');
        header.append('Content-Type', 'text/xml');

        const body=`
        <?xml version="1.0"?>
        <d:propertyupdate xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
          <d:set>
            <d:prop>
                        <d:lastmodified>Fri, 13 Feb 2015 00:00:00 GMT</d:lastmodified>
            </d:prop>
          </d:set>
        </d:propertyupdate>
        `
        // webdav.get(`${url}/Photos/Paris.jpg`, {headers: header})
        // webdav.mkcol(`${url}/newdir`, {headers: header})
        // webdav.move(`${url}/newdir`, {headers: header})
        // webdav.copy(`${url}/newdir`, {headers: header})
        // webdav.delete(`${url}/newdir2`, {headers: header})
        // webdav.propfind(`${url}/`, {headers: header})
        // webdav.put(`${url}/test`, body, {headers: header})
        webdav.proppatch(`${url}/test`, body, {headers: header})
                        .subscribe();
    }
}

Development

To generate all *.js, *.d.ts and *.metadata.json files:

$ git clone https://github.com/esanzgar/angular-webdav.git
$ cd angular-webdav
$ yarn
$ yarn build

To lint all *.ts files:

$ yarn lint

License

Apache-2.0 © Eduardo Sanz García

angular-webdav's People

Contributors

esanzgar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.