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.1.7 to 0.1.8

__tests__/read-file.js

17

index.js

@@ -212,2 +212,18 @@ 'use strict';

/**
* readFile
* @param {*} filePath
* @param {*} options https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fsreadfilesyncpath-options
*/
const readFile = (filePath, options) => {
// check
if(!filePath) return;
// opt
const opt = {encoding:'utf8'};
options = options || opt;
return fs.readFileSync(filePath, options);
};
exports.fs = fs;

@@ -221,2 +237,3 @@ exports.path = path;

exports.mkdir = mkdir;
exports.readFile = readFile;
exports.rm = rm;

4

package.json
{
"name": "qiao-file",
"version": "0.1.7",
"version": "0.1.8",
"description": "nodejs file tool",

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

},
"gitHead": "5e9e16d7d206079f9c7af85dd4996ff52ccec160"
"gitHead": "36c092e9ae9de0d0d7e784de1ea613733d579615"
}
# qiao-file
## api
### extname
## cmd
### cp
```javascript

@@ -10,6 +11,10 @@ 'use strict';

var test = function(){
var filePath = 'd:/test1/test2/test.js';
var s = q.extname(filePath);
console.log(s);
var folderPath = './test/';
var filePath = './qiao-file.js'
// cp folder
q.cp(folderPath, './test1');
// cp file
q.cp(filePath, './1.js');
};

@@ -20,3 +25,3 @@

### isExists
### rm
```javascript

@@ -28,6 +33,10 @@ 'use strict';

var test = function(){
var fpath = 'z:/workspaces/qiao.plugin.coder/lib/qiao.plugin.coder.js';
var s = q.isExists(fpath);
console.log(s);
var folderPath = 'd:/test1/';
var filePath = 'd:/test.png'
// rm folder
q.rm(folderPath);
// rm file
q.rm(filePath);
};

@@ -38,2 +47,3 @@

## dir
### lsdir

@@ -83,3 +93,4 @@ ```javascript

### rm
## file
### extname
```javascript

@@ -91,10 +102,22 @@ 'use strict';

var test = function(){
var folderPath = 'd:/test1/';
var filePath = 'd:/test.png'
var filePath = 'd:/test1/test2/test.js';
var s = q.extname(filePath);
console.log(s);
};
// rm folder
q.rm(folderPath);
// rm file
q.rm(filePath);
test();
```
### readFile
```javascript
'use strict';
var q = require('qiao-file');
var test = function(){
var filePath = './index.js';
var s = q.readFile(filePath);
console.log(s);
};

@@ -105,3 +128,4 @@

### cp
## is
### isExists
```javascript

@@ -113,10 +137,6 @@ 'use strict';

var test = function(){
var folderPath = './test/';
var filePath = './qiao-file.js'
// cp folder
q.cp(folderPath, './test1');
// cp file
q.cp(filePath, './1.js');
var fpath = 'z:/workspaces/qiao.plugin.coder/lib/qiao.plugin.coder.js';
var s = q.isExists(fpath);
console.log(s);
};

@@ -131,2 +151,3 @@

2. add lstree
3. read file

@@ -133,0 +154,0 @@ ### 0.1.1.20220417

'use strict';
// fs
import fs from 'fs';
// path

@@ -14,2 +17,18 @@ import path from 'path';

return path.extname(filePath.toLowerCase());
};
/**
* readFile
* @param {*} filePath
* @param {*} options https://nodejs.org/dist/latest-v16.x/docs/api/fs.html#fsreadfilesyncpath-options
*/
export const readFile = (filePath, options) => {
// check
if(!filePath) return;
// opt
const opt = {encoding:'utf8'};
options = options || opt;
return fs.readFileSync(filePath, 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