# chacent

> Node.js共享内存本机模块

Latest version **1.2.0** (published 2017-09-06) · MIT license · 0 weekly downloads

## Install

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

## 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.2.0 |
| Published | 2017-09-06 |
| First published | 2017-06-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 1 |
| Author | chacent |
| Maintainers | chacent |
| Keywords | share, memory |

## Links

- npm: https://www.npmjs.com/package/chacent
- Repository: https://chacent@github.com/chacent/shm
- Homepage: https://github.com/chacent/shm#readme
- Issues: https://github.com/chacent/shm/issues
- npm.io page: https://npm.io/package/chacent

## Dependencies (2)

- [nan](https://npm.io/package/nan.md) ^2.0.0
- [bindings](https://npm.io/package/bindings.md) ~1.2.1

## Recent versions

- 1.2.0 (latest) — 2017-09-06
- 1.1.0 — 2017-08-10
- 1.0.3 — 2017-06-18
- 1.0.2 — 2017-06-18
- 1.0.1 — 2017-06-18
- 1.0.0 — 2017-06-18
- 0.1.4 — 2017-06-17
- 0.1.3 — 2017-06-17
- 0.1.2 — 2017-06-17
- 0.0.11 — 2017-06-17
- 0.0.10 — 2017-06-17
- 0.0.9 — 2017-06-15
- 0.0.8 — 2017-06-15
- 0.0.7 — 2017-06-15
- 0.0.6 — 2017-06-15
- … 6 more at https://npm.io/package/chacent/versions

## README

# shm

nodejs 共享内存本机插件

不再需要安装boost头文件,已经将必要头文件提取（只测试了windows与centos，如果缺少头文件，请安装boost头文件）

使用时请注意：

1、内存映射不能太大，也就是map的第三个参数。因为windows系统对映射大小有限制，超出则会物理内存不足。按需取用是基本原则
2、map返回的buffer虽是普通buffer，但不要依赖其引用，因为取消映射依赖于buffer对象的释放，引用会占用物理内存
3、以下仅列出样例，函数参数参考boost(不完全相同，但是有参考意义，有时间再完整的整理下)

安装 npm install chacent

const shm  = require('chacent');

console.log(shm);//可用的常量值定义

let shared = shm('test',shm.open_create,shm.write);

shared.size()

shared.truncate(1024);

shared.remove();

//buffer有大小限制，不要对buffer引用

let buffer = shared.map(shm.write,0,20);

console.log(buffer);

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