Open Chinese Convert  0.4.3
A project for conversion between Traditional and Simplified Chinese
 All Data Structures Files Functions Variables Groups Pages
node/demo.js

This is an example of how to use the Node.js API.

// In your project you should replace './opencc' with 'opencc'
var OpenCC = require('./opencc');
// Load the default Simplified to Traditional config
var opencc = new OpenCC('zhs2zht.ini');
// Set conversion mode
opencc.setConversionMode(OpenCC.CONVERSION_FAST);
// Sync API
var converted = opencc.convertSync("汉字");
console.log(converted);
// Async API
opencc.convert("汉字", function (err, converted) {
console.log(converted);
});