Skip to content

Data format

SuenagaRyota edited this page Oct 4, 2017 · 5 revisions

Boostnote saves documents in a folder such as ~/Boostnote as cson files.

data structure

[ Boostnote 10:01 ]% tree
.
├── boostnote.json
├── images
│   ├── ay1wuf9yhw0wl8fr.png
│   ├── qppsh9gs44nghkt9.png
│   └── 44yt208ehhcnxw29.png
└── notes
    ├── 01f720cbd38f6079e7cd.cson
    ├── 0391ce9b4b6bf0ae8cb7.cson
    ├── 2b7d62d24dea826d8b86.cson
    ├── 304a604e620fe29efc0e.cson
    ├── b9c22f55de5747604fd8.cson
    ├── d9416376efecccfbfd36.cson
    └── f7780965124b6d8b8e9e.cson

2 directories, 11 files

boostnote.json

The contents of boostnote.json is

{
  "folders": [
    {
      "key": "49e4ebf9f16ddfc96534",
      "color": "#E10051",
      "name": "Tutorial"
    },
    {
      "key": "1de44c2b39b9288e7968",
      "color": "#2BA5F7",
      "name": "aaaaa"
    }
  ],
  "version": "1.0"
}

This is an image of the folder(storage).

image

Naming rule

Names used in Boostnote is created as a random string by keygen.js.

Folder name and Note name is a 20 letters string created by browser/main/lib/dataApi/createFolder.js and by browser/main/lib/dataApi/createNote.js.

https://github.com/BoostIO/Boostnote/blob/a480ca7b551bf70becf8000047b6608194c5c27c/browser/main/lib/dataApi/createFolder.js#L38:L57 https://github.com/BoostIO/Boostnote/blob/a480ca7b551bf70becf8000047b6608194c5c27c/browser/main/lib/dataApi/createNote.js#L54:L79

Image name is a 10 letters string created by browser/main/lib/dataApi/copyImage.js (We'll merge them someday) https://github.com/BoostIO/Boostnote/blob/a480ca7b551bf70becf8000047b6608194c5c27c/browser/main/lib/dataApi/copyImage.js#L20

Note hash

Each note has a unique hash for jumping a note to a note. You can check it in InfoPanel. image

In this case, the hash is 3bfa3f3e67aef359ac6f-b5176bbf1cc5f34cd578. This is a combination of Storage key and Note key (${storageKey}-${noteKey}).

The storage path is stored in localStorage.

Why cson?

CSON supports multiline string. So we can use diff much easier.

.json

{
  content: "a\nlot\nof\lines"
}

.cson

  content: """
    a
    lot
    of
    lines
  """

ref: https://github.com/BoostIO/Boostnote/issues/89