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

@lucafont2/onedrive-api

v1.1.1

Published

Onedrive Files Manager

Downloads

4

Readme

How to use:

(async function() {
     var onedrive = new OnedriveApi(YOUR_REFRESH_TOKEN,async function (error,userInfo) {
         if (error) {
             throw error;
         }  
     })
})();

The application provides you with a pre-built platform to get your refresh token Go to https://lucaservers.com/onedrivetoken/ authorize and get the token. In the future, you can revoke your token by going to https://account.live.com/consent/Manage

Functions

Method | desc | params | response --- | --- | --- | --- | getDrives() | Gives you all drives in your account | none | array of drive objects | getDrive(id) | Gives you all info of one drive| id: drive id got from getDrives() | info object | getDirChildren(id,path) | Gives you all children folders and files in path | id: drive id, path: absolute path in the drive | array of files and folders info objects | fileInfoByPath(id,filePath) | Gives file info by giving his path | id: drive id, filePath absolute path of file in the drive | file object | fileInfoById(id, fileId) | Gives file info by giving his id | id: drive id, fileId uniqId of the file got from getDirChildren() or fileInfoByPath() | file object | downloadFileById(id,fileId,dir) | Download file by the id | id: drive id, fileId: uniqId of the file, dir: directory to place the download | true if success | deleteFileById(id,fileId) | Delete file by the id | id: drive id, fileId: uniqId of the file | true if success | moveFileById(id,fileId,newDir,newName) | Move a file in the drive | id: drive id, fileId: uniqId of the file, newDir: absolute path of the new folder | true if success | copyFileById(id,fileId,newDir,newName) | Copy a file in the drive | id: drive id, fileId: uniqId of the file, newDir: absolute path of the new folder | true if success | createDirectory(id,dir,name) | Create a dir in the drive | id: drive id, dir: directory to place the folder, name: name of the new dir | Info object of the new folder | uploadFile(id,dir,name,localFile) | Upload a file | id: drive id, dir: directory to place the file, name: name of the file, localFile: string of the file path to upload | true if success | getFileShareLink(id,fileId,props) | Get file share link | id: drive id, fileId: uniqId of the file, props: props object | link String |

#Objects

###Drive object Key | Value | Description --- | --- | --- | id | String | Drive uniqId type | String | personal / business / documentLibrary owner | String | Name of owner

###File or folder object Key | Value | Description --- | --- | --- | id | String | Element uniqId name | Sting | Element name size | Int | Element bytes lastModified | String | Last Modified parent | String | Parent path type | String | File / Folder typeInfo | Object | if type is File contains mime and sha1

###Props object Key | Value | Description --- | --- | --- | type | String | Permission type view/edit/embed password | OPTIONAL - String | Password protected link scope | OPTIONAL - String | anonymous / organization expirationDateTime | OPTIONAL - String | Link exipiration

#Functions All functions work with async - promise

(async function() {
 var onedrive = new OnedriveApi(token,async function (error,userInfo) {
     try {
         if (error) {
             throw error;
         }
         console.log("Logged in with", userInfo.displayName);
         var drives = await onedrive.getDrives();
         console.log(drives);
         var drive = await onedrive.getDrive(drives[0]["id"]);
         console.log(drive);
     }catch (e) {
         console.log(e)
     }
 })

})();