New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@jiaminghi/print

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jiaminghi/print - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

6

CHANGELOG.md

@@ -1,3 +0,7 @@

### Release
### Release (2020-05-02)
- **release:** print.
### Release (2020-05-02)
- **release:** print.

@@ -13,8 +13,17 @@ "use strict";

},
success: function (info) {
console.log('\x1b[42;30m' + info + '\x1b[0m');
},
tip: function (info) {
console.log('\x1b[40;32m' + info + '\x1b[0m');
},
success: function (info) {
console.log('\x1b[42;30m' + info + '\x1b[0m');
red: function (info) {
console.log('\x1b[31m' + info + '\x1b[39m');
},
green: function (info) {
console.log('\x1b[32m' + info + '\x1b[39m');
},
white: function (info) {
console.log('\x1b[37m' + info + '\x1b[39m');
},
yellow: function (info) {

@@ -21,0 +30,0 @@ console.log('\x1b[31;33m' + info + '\x1b[0m');

2

package.json
{
"name": "@jiaminghi/print",
"version": "0.0.1",
"version": "0.1.0",
"author": "JiaMing <743192023@qq.com>",

@@ -5,0 +5,0 @@ "description": "Colorful console print for node.js",

[中文](./README.md)
<h1 align="center">FS</h1>
<h1 align="center">Print</h1>
<p align="center">
<a href="https://github.com/jiaming743/FS/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/jiaming743/FS.svg" alt="LICENSE" />
<a href="https://github.com/jiaming743/print/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/jiaming743/print.svg" alt="LICENSE" />
</a>
<a href="https://www.npmjs.com/package/@jiaminghi/fs">
<img src="https://img.shields.io/npm/v/@jiaminghi/fs.svg" alt="LICENSE" />
<a href="https://www.npmjs.com/package/@jiaminghi/print">
<img src="https://img.shields.io/npm/v/@jiaminghi/print.svg" alt="LICENSE" />
</a>
</p>
### Encapsulating some common file system methods with Promise (based Node.js - fs)
### Colorful console print for node.js
- **[stat](#stat)**
- **print.log**
fs.stat.
- **print.warn**
- **[mkDir](#mkDir)**
- **print.error**
fs.mkdir.
- **print.tip**
- **[access](#access)**
- **print.success**
fs.access.
- **print.yellow**
- **[copyDir](#copyDir)**
### Install width npm
Copy the folder to the specified location.
- **[readDir](#readDir)**
fs.readdir.
- **[clearDir](#clearDir)**
Recursively empty the specified folder.
- **[emptyDir](#emptyDir)**
Recursively empty the specified folder.
- **[readFile](#readFile)**
fs.readFile.
- **[writeFile](#writeFile)**
fs.writeFile.
- **[dirForEach](#dirForEach)**
Traverse all folders.
- **[fileForEach](#fileForEach)**
Recursively traverse all files.
- **[unlinkDirFileByExtname](#unlinkDirFileByExtname)**
Delete the specified extname file.
### Install with npm
```shell
$ npm install @jiaminghi/fs
$ npm install @jiaminghi/print
```

@@ -72,90 +36,6 @@

```javascript
import { readFile } from '@jiaminghi/fs'
```typescript
import print from '@jiaminghi/print'
// do something
```
<h3 align="center">Examples</h3>
#### stat
```typescript
type stat = (
path: fs.PathLike,
options: fs.StatOptions = { bigint: false }
) => Promise<fs.Stats | fs.BigIntStats | false>
```
#### mkDir
```typescript
type mkDir = (path: fs.PathLike, options: fs.MakeDirectoryOptions = {}) => Promise<boolean>
```
#### access
```typescript
type access = (path: fs.PathLike, mode = fs.constants.F_OK) => Promise<boolean>
```
#### copyDir
```typescript
type copyDir = (path: fs.PathLike, dest: string) => Promise<boolean>
```
#### readDir
```typescript
type readDir = (path: fs.PathLike) => Promise<string[] | false>
```
#### clearDir
```typescript
type clearDir = (path: fs.PathLike) => Promise<boolean>
```
#### emptyDir
```typescript
type emptyDir = (path: fs.PathLike) => Promise<boolean>
```
#### readFile
```typescript
type readFile = (
path: fs.PathLike,
options: { encoding: string; flag?: string } = { encoding: 'utf8' }
) => Promise<string | false>
```
#### writeFile
```typescript
type writeFile = (
path: fs.PathLike,
data: any,
option: fs.WriteFileOptions = 'utf8'
) => Promise<boolean>
```
#### dirForEach
```typescript
type dirForEach = (path: fs.PathLike, callback: (path: string) => any) => Promise<boolean>
```
#### fileForEach
```typescript
type fileForEach = (path: fs.PathLike, callback: (path: string) => any) => Promise<boolean>
```
#### unlinkDirFileByExtname
```typescript
type unlinkDirFileByExtname = (path: fs.PathLike, extnames: string[] = []) => Promise<boolean>
```
[ENGLISH](./README_EN.md)
<h1 align="center">FS</h1>
<h1 align="center">Print</h1>
<p align="center">
<a href="https://github.com/jiaming743/FS/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/jiaming743/FS.svg" alt="LICENSE" />
<a href="https://github.com/jiaming743/print/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/jiaming743/print.svg" alt="LICENSE" />
</a>
<a href="https://www.npmjs.com/package/@jiaminghi/fs">
<img src="https://img.shields.io/npm/v/@jiaminghi/fs.svg" alt="LICENSE" />
<a href="https://www.npmjs.com/package/@jiaminghi/print">
<img src="https://img.shields.io/npm/v/@jiaminghi/print.svg" alt="LICENSE" />
</a>
</p>
### 使用 Promise 封装了一些常用的文件系统方法(基于 Node.js 的 fs 文件系统)
### node.js 彩色控制台输出
- **[stat](#stat)**
- **print.log**
读取文件状态
- **print.warn**
- **[mkDir](#mkDir)**
- **print.error**
创建文件夹
- **print.tip**
- **[access](#access)**
- **print.success**
连接文件
- **print.yellow**
- **[copyDir](#copyDir)**
复制文件夹到指定位置,若文件夹已存在将被清空后进行复制操作
- **[readDir](#readDir)**
读取文件夹
- **[clearDir](#clearDir)**
递归清空文件夹,若文件夹不存在将被创建
- **[emptyDir](#emptyDir)**
递归清空文件夹
- **[readFile](#readFile)**
读取文件
- **[writeFile](#writeFile)**
写入文件
- **[dirForEach](#dirForEach)**
遍历文件夹
- **[fileForEach](#fileForEach)**
递归遍历文件
- **[unlinkDirFileByExtname](#unlinkDirFileByExtname)**
递归删除指定 extname 的文件
### npm 安装
```shell
$ npm install @jiaminghi/fs
$ npm install @jiaminghi/print
```

@@ -72,90 +36,6 @@

```javascript
import { readFile } from '@jiaminghi/fs'
```typescript
import print from '@jiaminghi/print'
// do something
```
<h3 align="center">示例</h3>
#### stat
```typescript
type stat = (
path: fs.PathLike,
options: fs.StatOptions = { bigint: false }
) => Promise<fs.Stats | fs.BigIntStats | false>
```
#### mkDir
```typescript
type mkDir = (path: fs.PathLike, options: fs.MakeDirectoryOptions = {}) => Promise<boolean>
```
#### access
```typescript
type access = (path: fs.PathLike, mode = fs.constants.F_OK) => Promise<boolean>
```
#### copyDir
```typescript
type copyDir = (path: fs.PathLike, dest: string) => Promise<boolean>
```
#### readDir
```typescript
type readDir = (path: fs.PathLike) => Promise<string[] | false>
```
#### clearDir
```typescript
type clearDir = (path: fs.PathLike) => Promise<boolean>
```
#### emptyDir
```typescript
type emptyDir = (path: fs.PathLike) => Promise<boolean>
```
#### readFile
```typescript
type readFile = (
path: fs.PathLike,
options: { encoding: string; flag?: string } = { encoding: 'utf8' }
) => Promise<string | false>
```
#### writeFile
```typescript
type writeFile = (
path: fs.PathLike,
data: any,
option: fs.WriteFileOptions = 'utf8'
) => Promise<boolean>
```
#### dirForEach
```typescript
type dirForEach = (path: fs.PathLike, callback: (path: string) => any) => Promise<boolean>
```
#### fileForEach
```typescript
type fileForEach = (path: fs.PathLike, callback: (path: string) => any) => Promise<boolean>
```
#### unlinkDirFileByExtname
```typescript
type unlinkDirFileByExtname = (path: fs.PathLike, extnames: string[] = []) => Promise<boolean>
```

@@ -11,8 +11,17 @@ const print = {

},
success(info: string): void {
console.log('\x1b[42;30m' + info + '\x1b[0m')
},
tip(info: string): void {
console.log('\x1b[40;32m' + info + '\x1b[0m')
},
success(info: string): void {
console.log('\x1b[42;30m' + info + '\x1b[0m')
red(info: string): void {
console.log('\x1b[31m' + info + '\x1b[39m')
},
green(info: string): void {
console.log('\x1b[32m' + info + '\x1b[39m')
},
white(info: string): void {
console.log('\x1b[37m' + info + '\x1b[39m')
},
yellow(info: string): void {

@@ -19,0 +28,0 @@ console.log('\x1b[31;33m' + info + '\x1b[0m')

@@ -5,6 +5,9 @@ declare const print: {

error(info: string): void;
success(info: string): void;
tip(info: string): void;
success(info: string): void;
red(info: string): void;
green(info: string): void;
white(info: string): void;
yellow(info: string): void;
};
export default print;
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