Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

qiao-file

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qiao-file - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

__tests__/write-file.js

18

index.js

@@ -254,2 +254,19 @@ 'use strict';

/**
* writeFile
* @param {*} filePath
* @param {*} fileData
* @param {*} options https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fswritefilesyncfile-data-options
*/
const writeFile = (filePath, fileData, options) => {
// check
if(!filePath) return;
// vars
fileData = fileData || '';
options = options || {};
fs.writeFileSync(filePath, fileData, options);
};
exports.fs = fs;

@@ -266,1 +283,2 @@ exports.path = path;

exports.rm = rm;
exports.writeFile = writeFile;

4

package.json
{
"name": "qiao-file",
"version": "0.2.2",
"version": "0.2.3",
"description": "nodejs file tool",

@@ -24,3 +24,3 @@ "author": "uikoo9 <uikoo9@qq.com>",

},
"gitHead": "351406b4394e71e571f10589f62911a34d76f7b8"
"gitHead": "22d02248eabd42498ffe164f5115dfcb0fc52552"
}

@@ -138,2 +138,16 @@ # qiao-file

### writeFile
```javascript
'use strict';
var q = require('qiao-file');
var test = function(){
var filePath = './1.js';
q.writeFile(filePath, '2');
};
test();
```
## is

@@ -160,2 +174,3 @@ ### isExists

2. mv
3. write file

@@ -162,0 +177,0 @@ ### 0.1.2.20220419

@@ -33,2 +33,19 @@ 'use strict';

return fs.readFileSync(filePath, options);
};
/**
* writeFile
* @param {*} filePath
* @param {*} fileData
* @param {*} options https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fswritefilesyncfile-data-options
*/
export const writeFile = (filePath, fileData, options) => {
// check
if(!filePath) return;
// vars
fileData = fileData || '';
options = options || {};
fs.writeFileSync(filePath, fileData, options);
};
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