Skip to content

Upload/Download files to Netsuite File Cabinet

License

Notifications You must be signed in to change notification settings

lyatziv/nscabinet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nscabinet NPM version Build Status Coveralls Status

Upload/download files to a netsuite account, using the included restlet.

PS: This is actually also a gulp plugin. A gulp-nscabinet wrapper module is also available.

Required

  • node.js 4+

Install Dependency Status devDependency Status

    npm install nscabinet

Input options

The parameters may be stored in ~/.ns/nsconfig.json, in environment variables, or passed directly.

For environment variables, prefix the options with "NSCONF_" and write in uppercase.

The following priority is taken for each parameter (using _.extend)

  1. Direct code input

  2. ./nsconfig.json, then ../nsconfig.json, up to 3 levels.

  3. ~/.ns/nsconfig.json

  4. Environment variables

nscabinet.upload

var nscabinet = require('nscabinet') ,
	vinylfs = require('vinyl-fs')

vinylfs.src('foo.js')
	.pipe(nscabinet({
		email : '[email protected]' ,
		password : '123456' ,
		account : '123456' ,
		realm : 'sandbox.netsuite.com' ,
		role : 3 ,
		rootPath : 'SuiteScripts/MyProject'
		script : 95 ,
		deployment : 1
	}))
  • realm defaults to system.netsuite.com.

  • role defaults to the account's default role.

  • deployment defaults to 1.

  • rootPath defaults to /SuiteScripts. Must begin with /.

nscabinet.download( files , [opts] )

nscabinet.download(['MyProject/*.js','/Web Site Hosting Files/My Site/*.html'])
	.pipe(vinylfs.dest('local'))
  • files file selector (one or many).

    • * is accepted on the file part, which is replaced by % on the netsuite file search.

    • Paths are also relative to opts.rootPath. If a file selector begins with /, files will be queried by absolute path in netsuite, but saved locally inside the cabinet_root folder.

  • opts The same options as seen in upload.

CLI

npm install -g nscabinet
$ nscabinet u "file.txt" --rootpath "/SuiteScripts/MyProject"
$ nscabinet u "file.txt" -p "/SuiteScripts/MyProject"
$ nscabinet u "file.txt"
$ nscabinet d "remote.txt" --rootPath "/Downloads"
$ nscabinet d "remote.txt" -p "/Downloads"
$ nscabinet d "remote.txt"

Takes in the same arguments (lowercased).

Encase path parameters in string quotes (avoids bash expansion).

As usual, the arguments are defaulted from nsconfig.json.

Sent file paths are taken relative to the config file path. Ex:

$ nscabinet u file.txt
Uploading file.txt to /SuiteScripts
$ cd Views
$ Views nscabinet u view.html
Uploading Views/view.html to /SuiteScripts

Gulp tasks

gulp/development.js is for straightforward tasks: lint and unit tests.

gulp/test.js is for more involved things.

About

Upload/Download files to Netsuite File Cabinet

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%