# file2string

> load file to string for pomelo

Latest version **1.0.0** (published 2017-11-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install file2string
pnpm add file2string
yarn add file2string
bun add file2string
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-11-15 |
| First published | 2017-11-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | luckyqqk |
| Maintainers | luckyqqk |
| Keywords | file2string, file-loader |

## Links

- npm: https://www.npmjs.com/package/file2string
- Repository: https://github.com/luckyqqk/file2string
- Homepage: https://github.com/luckyqqk/file2string#readme
- Issues: https://github.com/luckyqqk/file2string/issues
- npm.io page: https://npm.io/package/file2string

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2017-11-15

## README

# file2string
load file to string for pomelo
### 设计起源
* 项目中使用redis已很普遍,为了保证redis指令的原子性和顺序,往往会借助lua去执行.
* 我希望lua可独立出自己的文件,即可重复利用,也可独立编辑无需牵扯在业务代码里.
### 插件用途
* 读取文件内容,并以string的格式被读到内存,以方便程序使用.
* 以lua文件为例,延伸到支持读取所有类型的文件.
### 注意
* 若文件中是json格式的内容,应该以object的格式被读到内存.详情参见[json2memory](https://github.com/luckyqqk/json2memory.git)
### 使用方法
* 进入pomelo项目game-server下
```
npm install file2string --save
```
* 在pomelo项目config下,创建file2string文件夹,进入file2string,创建config.json
```
{
  "development": "/app/data/lua", // 你的lua文件目录
  "production": "/app/data/lua"   // 你的lua文件目录
}
```
* 在需要使用文件数据的地方调用以下代码
```
require('file2string').getFileString('fileName'); // 'fileName'是配置中的文件目录中的某个文件名
```
### 版本说明
* 1.0.0

---
_Source: https://npm.io/package/file2string · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
