Skip to content

A node c++ addon to I/O file. Just a example to learn how to write c++ addon.

Notifications You must be signed in to change notification settings

kwzm/node-iofile-addon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-iofile-addon

A node c++ addon to I/O file. Just a example to learn how to write c++ addon. There are two types: use native code and use boost lib.

Usage

Install dependences

$ npm install

Native

$ const { readFile, writeFile } = require('./src/native/build/Release/addon.node');
$ const buffer = readFile('filePath');

$ writeFile('filePath', buffer);

Boost

Install boost and compile boost lib

$const { readFile, writeFile } = require('./src/boost/build/Release/addon.node');
$ const buffer = readFile('filePath');

$ writeFile('filePath', buffer);

API

1、Buffer readFile(string filePath)

2、void writeFile(string filePath, Buffer content)

Notice

Node addon is compiled in x64, boost lib either.

If your platform is x86 , you need to recompile.

About

A node c++ addon to I/O file. Just a example to learn how to write c++ addon.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published