xmindparser
v1.0.2
Published
xmind解析为kityminder json格式,与kityminder json转xmind格式(支持浏览器)
Downloads
29
Readme
xmindparser
一个简单的javascript模块,用于Xmind 双向格式转换
安装
使用(npm)源安装,npm install xmindparser
可用脚本
npm run test
运行测试程序.
See the section about running tests for more information.
快速开始
xmind转json
const xmindparser = require('xmindparser');
let parser = new xmindparser()
//xmind转脑图 json 支持二进制文件或url和本地目录
const fileOrPath = 'test.xmind'
parser.xmindToJSON(fileOrPath).then(json => {
console.log(json)
})
json转xmind
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)
})
Methods
.xmindToJSON(params)
| Name | Type | Default | Required |
|:---- |:----:|:-------:|:--------:|
| params | (path,url,buffer,blob) | -
| Y |
.JSONToXmind(json,outputPath)
| Name | Type | Default | Required |
|:---- |:----:|:-------:|:--------:|
| json | (object) | -
| Y |
| outputPath | string | path.join(__dirname, '../')
| node:Y |