Open Chinese Convert
0.4.3
A project for conversion between Traditional and Simplified Chinese
Main Page
Related Pages
Modules
Data Structures
Files
Examples
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);
});
Generated on Fri May 17 2013 14:16:34 for Open Chinese Convert by
1.8.3.1