Socket
Socket
Sign inDemoInstall

node-tool-utils

Package Overview
Dependencies
40
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 1.2.0

10

CHANGELOG.md

@@ -0,1 +1,11 @@

<a name="1.2.0"></a>
# [1.2.0](https://github.com/hubcarl/node-tool-utils/compare/1.1.1...1.2.0) (2019-01-22)
### Features
* add writeFile and readFile method ([ee56121](https://github.com/hubcarl/node-tool-utils/commit/ee56121))
<a name="1.1.1"></a>

@@ -2,0 +12,0 @@ ## 1.1.1 (2018-10-10)

23

lib/tool.js

@@ -11,4 +11,4 @@ 'use strict';

const glob = require('glob');
const mkdirp = require('mkdirp');
exports.resolve = (filename, baseDir) => {

@@ -201,2 +201,23 @@ baseDir = baseDir || process.cwd();

}
};
exports.writeFile = (filepath, content) => {
try {
mkdirp.sync(path.dirname(filepath));
fs.writeFileSync(filepath, typeof content === 'string' ? content : JSON.stringify(content, null, 2), 'utf8');
} catch (e) {
console.error(`writeFile ${filepath} err`, e);
}
};
exports.readFile = filepath => {
try {
if (fs.existsSync(filepath)) {
const content = fs.readFileSync(filepath, 'utf8');
return JSON.parse(content);
}
} catch (e) {
/* istanbul ignore next */
}
return undefined;
};

9

package.json
{
"name": "node-tool-utils",
"version": "1.1.1",
"version": "1.2.0",
"description": "node cross-platform tool library",

@@ -18,6 +18,7 @@ "keywords": [

"cross-port-killer": "^1.0.1",
"mkdirp": "^0.5.1",
"node-glob": "^1.2.0",
"node-http-server": "^8.1.2",
"opn": "^5.4.0",
"shelljs": "^0.8.2",
"node-glob": "^1.2.0",
"node-http-server": "^8.1.2"
"shelljs": "^0.8.2"
},

@@ -24,0 +25,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc