New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nodejs-box

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodejs-box

Box API client for Node.JS

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-84.62%
Maintainers
1
Weekly downloads
 
Created
Source

Box API Node.JS Client

Install

npm install nodejs-box

Setup

First, you need to go through the OAuth2 process with Box.com, so that you can receive an access token. I recommend the box-passport module to help with this.

var Box = require('nodejs-box');

var box = new Box({
  access_token: 'YOUR_ACCESS_TOKEN_GOES_HERE',
  refreh_token: 'YOUR_REFRESH_TOKEN_GOES_HERE'
});

Example Usage

Working with files

Once you've creted a Box instance (see above section) you can act on file resources by calling functions on box.files.

Uploading a file

There are two ways to upload a file:

  • If the file has a custom filename

box.files.upload(filepath, filename, folderId, callback);

  • If the file does not have a custom filename

box.files.upload(filepath, folderId, callback);

Create and view information about a file

Get information about a file:

box.files.info(fileId, fields, callback);

Create metadata for a file:

box.files.createMetadata(fileId, metadata, callback);

Get all metadata for a file

box.files.getAllMetadata(fileId, callback);

Get specific metadata for a file. The path parameter is a combination of the scope and template attributes on the Box.com api, so will look like enterprise/marketingCollateral. For more detail, see the Box.com api docs

box.files.getMetadata(fileId, path, callback);

There are two ways to get a download link for a file:

  • Retrieve a download link for the given file without a shared item:

box.files.download(fileId, callback);

  • Retrieve a download link for the given file from a shared item:

box.files.download(fileId, shareLink, callback);

Create a shared link:

box.files.createSharedLink(file, sharedLinkSettings, callback);

UPDATED README COMING SOON

Keywords

FAQs

Package last updated on 31 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc