Polish (Poland)English (United Kingdom)

What is cookfs?

Cookfs is a Tcl virtual filesystem using a compressed archive format to allow embedding multiple files in an archive that Tcl scripts can access directly.

It is optimized for storing Tcl packages (allowing around 10%-20% smaller sizes ratio than mk4vfs while still using zlib compression), small, fast and integrated with Tcl.

It is designed only for use as Tcl VFS and provides multiple optimizations especially for delivering Tcl based standalone applications.

Latest cookfs version: 1.3.1 (released 2011-10-01) | download files


Tcl/Tk - Cookfs

cookfs::pages(n) 1.3.2 cookfs_pages "vfs::cookfs::pages"

Name

cookfs::pages - vfs::cookfs::pages

Description

Cookfs pages provide a low level mechanism for reading and writing to cookfs pages.

This mechanism should only be used by advanced users and is only documented for reference.

COMMANDS

::cookfs::pages ?options? archive

Creates a new pages object that can be used to read and write pages.

The command returns a pages command that can be used to perform actions on pages.

For definition of available options, see PAGES OPTIONS.

pagesHandle aside filename

Uses a separate file for storing changes to an archive. This can be used to keep changes for a read-only archive in a separate file. See cookfs for more details on aside files and how they can be used.

pagesHandle add contents

Add a new page to archive. Index of new page is returned. Index will be between 0 and length-1.

When adding a page that already exists, index to already existing page is returned. Otherwise a new page is added at the end and its index is returned.

pagesHandle get pageIdx

Gets a page in an archive. This can be between 0 and length-1.

pagesHandle length

Returns number of pages in an archive.

pagesHandle index ?newIndex?

Get or set index data. Index is a binary data that is stored in an archive and can be changed at any time. This is used to store exported version of cookfs_fsindex.

pagesHandle dataoffset

Returns offset to beginning of cookfs archive in the file.

pagesHandle delete

Saves all changes and deletes a cookfs pages object.

pagesHandle gethead
pagesHandle getheadmd5
pagesHandle gettail
pagesHandle gettailmd5

Gets part of file as binary data or MD5 checksum of it. Head is the part of the file prior to cookfs archive. Tail is the entire cookfs archive.

These commands can be used as helper procedures to read or compare currently open/mounted binaries.

pagesHandle cachesize ?numPages?

Sets or gets maximum number of pages to store in cache. If numPages is specified, size is modified. If more than numPages pages are currently buffered, they are removed from cache. If 0, no cache is used. Otherwise, up to numPages are kept in memory

pagesHandle filesize

Returns size of file up to last stored page. The size only includes page sizes and does not include overhead for index and additional information used by cookfs.

pagesHandle hash

Hash function to use for comparing if pages are equal. This is mainly used as pre-check and entire page is still checked for. Defaults to md5, can also be crc32. Mainly for internal/testing at this moment. Do not use.

pagesHandle close

Closes pages object and return offset to end of cookfs archive. This is almost an equivalent of calling delete.

This is meant for internal development and should not be used outside cookfs.

PAGES OPTIONS

The following options can be specified when creating a cookfs pages object:

-readwrite

Open as read-write, which is the default. If file exists and is valid cookfs pages format archive, it is used. Otherwise new cookfs pages archive is created at end of file.

-readonly

Open as read-only. File must exist and be in valid cookfs pages format archive, otherwise operation will fail.

-cachesize numPages

Maximum number of pages to store in cache. If 0, no cache is used. Otherwise, up to numPages are kept in memory for efficient access.

-endoffset offset

Read archive starting at specified offset, instead of reading from end of file.

This feature is used when cookfs archive is not stored at end of file - for example if it is used in tclkit and followed by mk4vfs archive.

-compression none|zlib|bzip2|custom

Compression to use for storing new files.

See cookfs for more details on compression in cookfs.

-compresscommand tcl command

For custom compression, specifies command to use for compressing pages.

See cookfs for more details on compression in cookfs.

-decompresscommand tcl command

For custom compression, specifies command to use for decompressing pages.

See cookfs for more details on compression in cookfs.

See Also

cookfs_fsindex, cookfs_pages

Keywords

cookfs, vfs

 
Tcl 8.5 Network Programming book
Learning Nagios 3.0 book