xml相关
xml转json
: npm包 xml2js
1 2 3 4 5 6 7
| var xml='<xml><a>1</a><b>2</b></xml>'; blue.promisify(new xml2js.Parser({explicitArray:false,explicitRoot:false}).parseString)(xml).then(function(result){ console.dir(result); },function(error){ })
|
json转xml
:npm包 xmlbuilder
1 2 3 4 5 6 7 8 9 10 11
| //‘xml’ root名称,headless: true 去掉 xml 头部,pretty: true 格式化 var json = { a: 1, b: 2 }; console.error(xmlbuilder.create('xml',{headless: true}).ele(json).end({ pretty: true})) <xml> <a>1</a> <b>2</b> </xml>
|
bluebird
promise.promisify 将api promise 化
prcess
To set an environment variable in Windows
:
1
| SET NODE_ENV=development
|
on OS X or Linux
1
| export NODE_ENV=development
|