# The &basket; Handbook

Gleb Baryshev gleb.baryshev@gmail.com
2016-11-07
2.11

Taking care of your ideas.

KDE BasKet

## NOTICE: handbook not written yet

&basket; still does not have a handbook, so contributors are welcome! Check the KDE documentation for the hints on the DocBook format.

Meanwhile, you can look for help on the Internet. In particular, look through the old website or check Linux magazines if you have access to them, for example:

- Tutorial: Basket: Capture your thoughts. Linux Format 120 (Andy Channelle)

- A Virtual Basket. Storing, sorting, and filing with KDE's Basket Linux Magazine 54 (Stefanie Teufel)

## Introduction

&basket; is mainly an all-purpose notes taker, but a particular one:

## Using BasKet

### Version Sync

When enabled, Version Sync puts your baskets and notes under version control. Currently this is an experimental feature and only very basic functions are implemented, so it may require additional software and some manual setup. These are some of the things that can be done using external tools (but not Basket interface yet):

- check out old revisions and revert the changes

- synchronize baskets on several computers (merge the changes)

- push baskets backup to remote repository

To enable it, select Settings Configure BasKet Note Pads → Version Sync and Enable distributed version control. It will initialize git repository in `~/.kde/share/apps/basket/baskets`, upon which standard git tools can be used.

#### Clearing version history

Clearing the history can be useful in these cases:

- you have locked a basket and want to remove any previous unencrypted versions (which are still stored in the system)

- you want to free some disk space (can be topical if you insert a lot of images or other files into Basket)

Note that you will have to redo any manual setup you did on the git repository.

## BasKet file structure

### Introduction

### BasKet Archive file format

The BasKet file format (.baskets) is a structure which wraps a compressed tar and a preview image. The latest archive format version is 0.6.1.

#### File Structure

The archive file is divided into the structures: file header, preview image header, a preview image (.png), archive header, and a gunzipped tar archive (.tar.gz) containing a baskets file tree as illustrated in the following sketch

#### Archive file header

The file header is a short structure, consisting of lines of strings, the file declarator, and the format version

The first 17 bytes contain the literal string `BasKetNP:archive` followed by a new line feed symbol (0x0A) in ISO-8859-1 encoding.

The second string is a literal string `version:0.6.1` followed by a line feed symbol (0x0A) in ISO-8859-1 encoding.

An example:

    BasKetNP:archive
    version:0.6.1

#### Preview image header

Currently, the basket archive file contains a preview file which is derived from the first basket's content.

Directly following the file header, a literal string `preview*:<size>` in ISO-8859-1 encoding, again followed by a line feed symbol. The parameter `<size>` is a string of decimal numbers. It declares the size in bytes of the preview image. `<size>` is of type unsigned long.

An example:

    preview*:12000

#### Preview image file

The preview image is of type .png. Its size is specified by the preview image header. The preview image file is inserted as file stream, and directly follows the preview image header.

#### BasKet content archive header

Just like for the preview image file, the content archive is preceded by a string specifying its size. That string directly follows the file stream of the archive.

That string must be `archive*:<size>` followed by a line feed symbol, in ISO-8869-1 encoding. The parameter `<size>` is a unsigned long integer in string format.

An example:

    archive*:1245000

#### BasKet content archive

The content archive contains the BasKet file tree compressed in to a gzipped tar archive (.tar.gz). Its size is specified by the content header.

#### Example byte stream

The following table shows key parts of the basket archive file content. The left column specifies the offset in the file stream. The center column gives the byte stream at the current offset in hexadecimal format. The right column shows printable characters within the file stream at the current offset.

## Questions, Answers, and Tips

Frequently asked questions

Question 1

The answer