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.
- node.js 4+
npm install nscabinet
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
)
-
Direct code input
-
./nsconfig.json
, then../nsconfig.json
, up to 3 levels. -
~/.ns/nsconfig.json
-
Environment variables
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 tosystem.netsuite.com
. -
role
defaults to the account's default role. -
deployment
defaults to 1. -
rootPath
defaults to/SuiteScripts
. Must begin with/
.
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 thecabinet_root
folder.
-
-
opts
The same options as seen in upload.
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/development.js is for straightforward tasks: lint and unit tests.
gulp/test.js is for more involved things.