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

seafile-api

v0.3.0

Published

npm module for Seafile Web API

Downloads

11

Readme

seafile-api

NPM Version NPM Downloads Node.js Version

seafile-api is a small npm module for accessing the Seafile Web API and thus controlling a Seafile instance from within a Node.js application.

Though there are quite many API methods, at the moment this module just implements a small subset of the available functions.

Documentation

Installation

$ npm install seafile-api

Initialization

You will need a valid access token to make API requests. See the API docs for further information on how to obtain a token: Web API | Quick Start. At the moment, this module does not support obtainment of access tokens.

var SeafileAPI = require('seafile-api');
var sf = new SeafileAPI('https://cloud.seafile.com', 'accesstoken123456789');

Usage

See the official API docs for detailed information about the methods and used parameters. Default values are used if optional parameters are not set.

listAccounts(params, callback)

Seafile API Docs

sf.listAccounts({
  start: 0,
  limit: 100,
  scope: 'DB'
}, function(err, accounts, httpcode){
  if(err) console.error('Error:', err);
  console.log(accounts);
});
  • All parameters are optional

getAccountInfo(email, callback)

Seafile API Docs

sf.getAccountInfo('[email protected]', function(err, body, httpcode){
    console.log(body);
});

createAccount(params, callback)

Seafile API Docs

sf.createAccount({
  email: '[email protected]',
  password: 'foobar123',
  is_staff: 0,
  is_active: 1
}, function(err, data, httpcode){
  console.log(data);
});
  • email: required
  • password: required
  • is_staff: optional
  • is_active: optional

updateAccount(params, callback)

Seafile API Docs

sf.updateAccount({
  email: '[email protected]',
  name: 'John Doe',
  is_staff: 0,
  is_active: 1
}, function(err, body, httpcode){
  console.log(body);
});
  • email: required
  • all other params are optional

deleteAccount(email, callback)

Seafile API Docs

sf.deleteAccount('[email protected]', function(err, body, httpcode){
  console.log(body);
});

addGroupMember(options, callback)

Seafile API Docs

sf.addGroupMember({
  user_name: '[email protected]',
  group_id: 1
}, function(err, body){
    console.log(body);
});
  • user_name: required
  • group_id: required

deleteGroupMember(options, callback)

Seafile API Docs

sf.deleteGroupMember({
  user_name: '[email protected]',
  group_id: 1
}, function(err, body){
    console.log(body);
});
  • user_name: required
  • group_id: required

moveMultiple(options, callback)

Seafile API Docs

sf.moveMultiple({
    src_repo: 'source_repo_id',
    dst_repo: 'dest_repo_id',
    file_names: [
        'file.txt',
        'image.jpg'
    ],
    dst_path: '/',
    p: '/'
}, function(err, body){
    console.log(body);
});
  • src_repo: required
  • dst_repo: required
  • file_name: required
  • all other params are optional

renameDirectory(options, callback)

Seafile API Docs

sf.renameDirectory({
    repo_id: 'repo_id',
    p: 'foo',
    newname: 'pinkfloyd_newfolder'
}, function(err, body){
  console.log(body);
});
  • repo_id: required
  • p: required
  • newname: required

createDirectory(options, callback)

Seafile API Docs

sf.createDirectory({
    repo_id: 'repo_id',
    p: 'bar',
}, function(err, body){
  console.log(body);
});
  • repo_id: required
  • p: required

listDirEntries(options, callback)

Seafile API Docs

sf.listDirEntries({
    repo_id: 'repo_id',
    p: '/',
    t: 'd',
    recursive: 1
}, function(err, body){
  console.log(body);
});
  • repo_id: required
  • all other params are optional

License

MIT