一个简单的javascript模块,用于Xmind 双向格式转换
使用(npm)源安装,npm install xmindparser
运行测试程序.
See the section about running tests for more information.
const xmindparser = require('xmindparser');
let parser = new xmindparser()
//xmind转脑图 json 支持二进制文件或url和本地目录
const fileOrPath = 'test.xmind'
parser.xmindToJSON(fileOrPath).then(json => {
console.log(json)
})
const xmindparser = require('xmindparser');
let parser = new xmindparser()
const json = {
"template": "default",
"theme": "fresh-blue",
"root": {
"data": {"text": "中心主题", "note": "", "imageSize": {}},
"children": [{
"children": [{"children": [], "data": {"text": "新建节点", "note": "", "imageSize": {}}}],
"data": {"text": "新建节点", "note": "", "imageSize": {}}
}, {
"children": [{"children": [], "data": {"text": "新建节点", "note": "", "imageSize": {}}}],
"data": {"text": "新建节点", "note": "", "imageSize": {}}
}, {"children": [], "data": {"text": "新建节点", "note": "", "imageSize": {}}}, {
"children": [],
"data": {"text": "新建节点", "note": "", "imageSize": {}}
}, {"children": [], "data": {"text": "新建节点", "note": "", "imageSize": {}}}, {
"children": [],
"data": {"text": "新建节点", "note": "", "imageSize": {}}
}]
}
}
//脑图 json转xmind 浏览器返回blob node返回pathurl
const fileOrPath = 'test.xmind'
parser.JSONToXmind(json,outputPath).then(data => {
console.log(data)
})
Name | Type | Default | Required |
---|---|---|---|
params | (path,url,buffer,blob) | - |
Y |
Name | Type | Default | Required |
---|---|---|---|
json | (object) | - |
Y |
outputPath | string | path.join(__dirname, '../') |
node:Y |