HomeForumSourceResearchGuide
Sign in to contribute to source. how it works
Type definition file compress.Archive by barry
expand copy to clipboardexpand
uses data.String
uses io.File

uses time.DateTime

/* { "description" : "A file entry from an archive."} */
data ArchiveFile {
	/* { "@description" : "The file path of this entity inside the archive."} */
	char path[]
	/* { "@description" : "Whether this entity is a file or directory."} */
	bool dir
	/* { "@description" : "This compressed size of this entity in the archive."} */
	int compressedSize
	/* { "@description" : "The uncompressed size of this entity when extracted."} */
	int uncompressedSize
	/* { "@description" : "The last-modified time of this entity."} */
	DateTime modified
	}

/* { "description" : "Interface to read file archives, often using compression."} */
interface Archive {
	
	/* { "@description" : "Create a new Archive instance, which will read the archive from the given file."} */
	Archive(store File fd)
	
	/* { "@description" : "Get the contents of the given directory within the archive (or the root folder, if path is null)."} */
	ArchiveFile[] getContents(char path[])
	/* { "@description" : "Get all contents of the archive as a flat list."} */
	ArchiveFile[] getAllContents()
	/* { "@description" : "Check if a given file or directory exists in the archive."} */
	bool exists(char path[])
	/* { "@description" : "Get the details of a given file or directory in the archive."} */
	ArchiveFile getInfo(char path[])
	
	/* { "@description" : "Extract (decompress) a file in the archive, returning the extracted bytes. Use of this function is generally suitable only for small files."} */
	byte[] extractFile(char path[])
	
	/* { "@description" : "Extract (decompress) a file in the archive, writing the extracted file to the given output file."} */
	bool extractFileTo(char path[], File ofd)
	
	}
Revision history
To propose a new revision to this entity, use dana source put -ut your/new/version.dn -n compress.Archive -m "reason for update" -u yourUsername
Version 1 (this version) by barry
Notes for this version: Standard Library Initialisation