npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

js-owncloud-client

v0.1.3

Published

ownCloud client library for JavaScript

Downloads

2,196

Readme

Build Status Dependencies Status devDependencies Status

Use this light-weight JS library with a promise based interface for seaemless communication with your ownCloud instance. Supports both Node.JS and browser JS.

Install

$ npm install js-owncloud-client

Usage

Node.JS

var owncloud = require('js-owncloud-client');
var oc = new owncloud('*owncloud instance URL*');

// Login
oc.login('username', 'password').then(status => {
    // STUFF
}).catch(error => {
    // HANDLE ERROR
});

// Share File With Link
oc.shares.shareFileWithLink('linkToYourFile').then(shareInfo => {
    console.log("Link is : " + shareInfo.getLink());
}).catch(error => {
    // HANDLE ERROR
});

// List all files
oc.files.list('/path/to/file/folder').then(files => {
    console.log(files);
}).catch(error => {
    console.log(error);
});

Browser

<script type="text/javascript" src="./js-owncloud-client/browser/bundle.js"></script>

<script type="text/javascript">
  // var oc is global
  oc.setInstance('*owncloud instance URL*');

  // Login
  oc.login('username', 'password').then(status => {
    window.alert(status);
  }).catch(error => {
    window.alert(error);
  });

  // Share File With Link
  oc.shares.shareFileWithLink('linkToYourFile').then(shareInfo => {
      window.alert("Link is : " + shareInfo.getLink());
  }).catch(error => {
      window.alert(error);
  });

  // List all files
  oc.files.list('/path/to/file/folder').then(files => {
      console.log(files);
  }).catch(error => {
      console.log(error);
  });
</script>

All Methods Available

General

var owncloud = require('js-owncloud-client');
var oc = new owncloud('*owncloud instance URL*');

Method | Code ----------------|------------------------------ setInstance | oc.setInstance(instance) login | oc.login(username, password) getConfig | oc.getConfig() getVersion | oc.getVersion() getCapabilities | oc.getCapabilities()

Files Management

var owncloud = require('js-owncloud-client');
var oc = new owncloud('*owncloud instance URL*');

Method | Code ------------------|---------------------------------------------------- list | oc.files.list(/path/to/file/folder, depth) getFileContents | oc.files.getFileContents(path/to/file/folder) putFileContents | oc.files.putFileContents(path/to/file, contents) mkdir | oc.files.mkdir(path/to/folder) createFolder | oc.files.createFolder(path/to/folder) delete | oc.files.delete(path/to/file/folder) fileInfo | oc.files.fileInfo(path/to/file/folder) getFile | oc.files.getFile(remotePath, localPath) getDirectoryAsZip | oc.files.getDirectoryAsZip(remotePath, localPath) putFile | oc.files.putFile(remotePath, localPath) putDirectory | oc.files.putDirectory(remotePath, localPath) move | oc.files.move(source, target) copy | oc.files.copy(source, target)

Apps Management

var owncloud = require('js-owncloud-client');
var oc = new owncloud('*owncloud instance URL*');

Method | Code ----------------|---------------------------------------- getApps | oc.apps.getApps() getAttribute | oc.apps.getAttribute(app, key) setAttribute | oc.apps.setAttribute(app, key, value) deleteAttribute | oc.apps.deleteAttribute(app, key) enableApp | oc.apps.enableApp(appName) disableApp | oc.apps.disableApp(appName)

Group Management

var owncloud = require('js-owncloud-client');
var oc = new owncloud('*owncloud instance URL*');

Method | Code ----------------|--------------------------------------- createGroup | oc.groups.createGroup(groupName) deleteGroup | oc.groups.deleteGroup(groupName) getGroups | oc.groups.getGroups() getGroupMembers | oc.groups.getGroupMembers(groupName) groupExists | oc.groups.groupExists(groupName)

Share Management

var owncloud = require('js-owncloud-client');
var oc = new owncloud('*owncloud instance URL*');

Method | Code --------------------|---------------------------------------------------------------------------------------------------- shareFileWithLink | oc.shares.shareFileWithLink(path, {perms: perms, publicUpload: publicUpload, password: password}) updateShare | oc.shares.updateShare(shareId, {perms: perms, publicUpload: publicUpload, password: password}) shareFileWithUser | oc.shares.shareFileWithUser(path, username, {perms: perms, remoteUser: remoteUser }) shareFileWithGroup | oc.shares.shareFileWithGroup(path, groupname, {perms: perms }) getShares | oc.shares.getShares() isShared | oc.shares.isShared(path/to/file/folder) getShare | oc.shares.getShare(shareId) listOpenRemoteShare | oc.shares.listOpenRemoteShare() acceptRemoteShare | oc.shares.acceptRemoteShare(shareId) declineRemoteShare | oc.shares.declineRemoteShare(shareId) deleteShare | oc.shares.deleteShare(shareId)

User Management

var owncloud = require('js-owncloud-client');
var oc = new owncloud('*owncloud instance URL*');

Method | Code -----------------------|------------------------------------------------------ createUser | oc.users.createUser(username, password) deleteUser | oc.users.deleteUser(username) searchUsers | oc.users.searchUsers(searchKey) userExists | oc.users.userExists(username) getUsers | oc.users.getUsers() setUserAttribute | oc.users.setUserAttribute(username, key, value) addUserToGroup | oc.users.addUserToGroup(username, groupName) getUserGroups | oc.users.getUserGroups(username) userIsInGroup | oc.users.userIsInGroup(username, groupName) getUser | oc.users.getUser(username) removeUserFromGroup | oc.users.removeUserFromGroup(username, groupName) addUserToSubadminGroup | oc.users.addUserToSubadminGroup(username, groupName) getUserSubadminGroups | oc.users.getUserSubadminGroups(username) userIsInSubadminGroup | oc.users.userIsInSubadminGroup(username, groupName)

Building the Documentation

Swagger Documentation

Stuck? Just type this to see all the above available methods live in action in your browser!

$ cd node_modules/js-owncloud-client/
$ make swagger

If you open the link showed by running the above command, you will see something like this :

SwaggerDemo

Here, you can click on any method and type in values, to experiment with the methods in the browser itself! Now isn't that cool? :wink:

JSDocs

To build the jsdocs, type this command and follow the instructions on the terminal :

$ cd node_modules/js-owncloud-client/
$ make jsdocs

Unit tests

The following command will run all unit tests. Before running the command, make sure you have edited the owncloud/test/config.json file accordingly.

$ cd node_modules/js-owncloud-client/
$ make test

Team

Noveen Sachdeva         Vincent Petry Noveen Sachdeva             Vincent Petry

GSoC'17