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

filecloud-client

v0.1.7

Published

Server side client for uploading files to filecloud and interacting with the filecloud service

Downloads

169

Readme

Filecloud Client

This package provides a client for interacting with the filecloud user api. It provides a simple implentation for node.js scripts to upload files, create folders and copy folders. The goal is to support all user api's provided by file cloud.

Usage

Authenticate


import FileCloud from 'filecloud-client'
import fs from 'node:fs';

let FCClient = new FileCloud('https://my.filecloud.com','username','password');
await FCClient.login(); 

Create a Folder


FCClient.createFolder('firstfolder', '/myfiles');

returns a javascript object on success

    {
      type: 'createfolder',
      result: '1',
      message: 'Folder Created Successfully'
    }

Upload a file from disk


fs.readFile('C:/test.txt', 'utf8', (err, data) => {
    if(err){
        console.log(err);
        return;
    }
    FCClient.uploadFile('test.txt', '/myfiles/firstfolder', data);
});

Generate a quickshare link

fs.quickShare('firstfolder', '/myfiles');

returns a javascript object

Get list of files and folders in a directory

FCClient.getfilelist('/scott', {});

returns a javascript object


{
  meta: {
    parentpath: '/',
    total: '11',
    realpath: '/scott',
    canupload: '1',
    isshareable: '1',
    candownload: '1',
    cansetacls: '0',
    showshareoption: '0',
    teamfolder: '0',
    result: '1',
    message: '',
    defaultfile: '',
    showzipfolders: '0',
    aboutfile: ''
  },
  entries: [
    {
      path: '/scott/firstfolder',
      dirpath: '/scott/',
      name: 'firstfolder',
      ext: '',
      fullsize: '0',
      modified: 'Jul 19, 2024 2:32 PM',
      type: 'dir',
      fullfilename: '/scott/firstfolder',
      size: '',
      modifiedepoch: '1721399577',
      modifiedepochutc: '1721417577',
      modifiediso: '2024-07-19T14:32:57+0000',
      isroot: '0',
      isshareable: '1',
      issyncable: '0',
      isshared: 'private',
      canrename: '1',
      showprev: '0',
      canfavorite: '1',
      canupload: '1',
      candownload: '1',
      favoritelistid: '',
      favoriteid: '',
      order: '0',
      showquickedit: '1',
      showlockunlock: '1',
      showshareoption: '0',
      cansetacls: '0',
      tagged: '0',
      commented: '0',
      isreshared: '0',
      canmanageshare: '0',
      lastmodifiedby: 'scott',
      locked: '0',
      hasnotificationsrule: '0'
    }
  ]
}

Deep copy a folder from one location to another


await FCClient.copyFilesAndFolders('/myfiels/firstfolder', '/myfiles', 'copiedfolder');

General calls

For any calls that haven't been implemented by the library base calls can be used

url is the endpoint params are the paramter string body is a json object

FCClient.sendPostRequest(endpoint, params, body); 

for example, body can be ommited, params are in url paramters string fromat

FCClient.sendPostRequest('/core/createfolder', 'name='+folderName+'&path='+path)

If you don't have any url parameters but have a body pass undefined or null for parameters and include the body

FCClient.sendPostRequest('/core/getfilelist', undefined, body)

install form-data package to generate a from to send to a post request

FCClient.sendFormPostRequest(url, form)

const form = new FormData();
form.append('path', '/myfiles'); 
form.append('name', 'test.txt');
form.append('copyto', '/myfiles/newfolder');

FCClient.sendFormPostRequest('/core/copyfile', form).then(response => {
  console.log(response.data);
}).catch(error => {
  console.log(error);
});