Skip to content

xieguanhua/xmindparser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

xmind转百度脑图json格式与百度脑图json转xmind,支持浏览器与node

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published