riff

Search:
Group by:

Author:John Novak <john@johnnovak.net>

[nim-riff is a library for reading and writing Resource Interchange File Format (RIFF) files.

Main features:

  • Reading/writing of little-endian (RIFF) and big-endian (RIFX) RIFF files
  • Strict adherence to the RIFF standard
  • Convenient helper methods to navigate the chunk hierarchy
  • Cursor support

Please refer to the guide and examples on how to use the library.

Visit the project's GitHub repository for further info: https://github.com/johnnovak/nim-riff

Types

ChunkInfo = object
  id*: string                ## 4-char chunk ID (FourCC)
  size*: uint32              ## chunk data length in bytes (NOT including the
                             ## optional pad byte if data length is odd)
  filePos*: int64            ## absolute position in bytes from the start of the file
  case kind*: ChunkKind      ## ckGroup - group chunks,
                             ## ckChunk - normal subchunks
  of ckGroup:
    formatTypeId*: string    ## format type FourCC for group chunks
  of ckChunk:
    nil
  
contains information about a chunk
ChunkKind = enum
  ckChunk, ckGroup
ChunkSeekPos = enum
  cspSet, cspCur, cspEnd
cspSet - from the start of the chunk cspCur - from the current position cspEnd - from the end of the chunk
Cursor = object
  path*: seq[ChunkInfo]
  chunkPos*: uint32
  filePos*: int64
a location in the RIFF file (a chunk path plus a chunk offset)
RiffPrimitives = char | int8 | int16 | int32 | int64 | uint | uint8 | uint16 |
    uint32 |
    uint64 |
    float32 |
    float64
RiffReader = ref object
  
a RIFF file opened for reading
RiffReadError = object of IOError
RiffWriteError = object of IOError
RiffWriter = ref object
  

Lets

infoSubchunkNames = toTable([(FourCC_INFO_IARL, "Archival Location"),
                             (FourCC_INFO_IART, "Artist"),
                             (FourCC_INFO_ICMS, "Commissioned"),
                             (FourCC_INFO_ICMT, "Comments"),
                             (FourCC_INFO_ICOP, "Copyright"),
                             (FourCC_INFO_ICRD, "Creation Date"),
                             (FourCC_INFO_ICRP, "Cropped"),
                             (FourCC_INFO_IDIM, "Dimensions"),
                             (FourCC_INFO_IDPI, "Dots Per Inch"),
                             (FourCC_INFO_IENG, "Engineer"),
                             (FourCC_INFO_IGNR, "Genre"),
                             (FourCC_INFO_IKEY, "Keywords"),
                             (FourCC_INFO_ILGT, "Lightness"),
                             (FourCC_INFO_IMED, "Medium"),
                             (FourCC_INFO_INAM, "Name"),
                             (FourCC_INFO_IPLT, "Palette Setting"),
                             (FourCC_INFO_IPRD, "Product"),
                             (FourCC_INFO_ISBJ, "Subject"),
                             (FourCC_INFO_ISFT, "Software"),
                             (FourCC_INFO_ISHP, "Sharpness"),
                             (FourCC_INFO_ISRC, "Source"),
                             (FourCC_INFO_ISRF, "Source Form"),
                             (FourCC_INFO_ITCH, "Technician"),
                             (FourCC_INFO_AGES, "Rated"),
                             (FourCC_INFO_CMNT, "Comment"),
                             (FourCC_INFO_CODE, "Encoded By"),
                             (FourCC_INFO_COMM, "Comments"),
                             (FourCC_INFO_DIRC, "Directory"),
                             (FourCC_INFO_DISP, "Sound Scheme Title"),
                             (FourCC_INFO_DTIM, "Date Time Original"),
                             (FourCC_INFO_GENR, "Genre"),
                             (FourCC_INFO_IAS1, "First Language"),
                             (FourCC_INFO_IAS2, "Second Language"),
                             (FourCC_INFO_IAS3, "Third Language"),
                             (FourCC_INFO_IAS4, "Fourth Language"),
                             (FourCC_INFO_IAS5, "Fifth Language"),
                             (FourCC_INFO_IAS6, "Sixth Language"),
                             (FourCC_INFO_IAS7, "Seventh Language"),
                             (FourCC_INFO_IAS8, "Eighth Language"),
                             (FourCC_INFO_IAS9, "Ninth Language"),
                             (FourCC_INFO_IBSU, "Base URL"),
                             (FourCC_INFO_ICAS, "Default Audio Stream"),
                             (FourCC_INFO_ICDS, "Costume Designer"),
                             (FourCC_INFO_ICMS, "Commissioned"),
                             (FourCC_INFO_ICMT, "Comment"),
                             (FourCC_INFO_ICNM, "Cinematographer"),
                             (FourCC_INFO_ICNT, "Country"),
                             (FourCC_INFO_IDIT, "Date Time Original"),
                             (FourCC_INFO_IDST, "Distributed By"),
                             (FourCC_INFO_IEDT, "Edited By"),
                             (FourCC_INFO_IENC, "Encoded By"),
                             (FourCC_INFO_ILGU, "Logo URL"),
                             (FourCC_INFO_ILIU, "Logo Icon URL"),
                             (FourCC_INFO_ILNG, "Language"),
                             (FourCC_INFO_IMBI, "More Info Banner Image"),
                             (FourCC_INFO_IMBU, "More Info Banner URL"),
                             (FourCC_INFO_IMIT, "More Info Text"),
                             (FourCC_INFO_IMIU, "More Info URL"),
                             (FourCC_INFO_IMUS, "Music By"),
                             (FourCC_INFO_IPDS, "Production Designer"),
                             (FourCC_INFO_IPRO, "Produced By"),
                             (FourCC_INFO_IRIP, "Ripped By"),
                             (FourCC_INFO_IRTD, "Rating"),
                             (FourCC_INFO_ISGN, "Secondary Genre"),
                             (FourCC_INFO_ISMP, "Time Code"),
                             (FourCC_INFO_ISTD, "Production Studio"),
                             (FourCC_INFO_ISTR, "Starring"),
                             (FourCC_INFO_IWMU, "Watermark URL"),
                             (FourCC_INFO_IWRI, "Written By"),
                             (FourCC_INFO_LANG, "Language"),
                             (FourCC_INFO_LOCA, "Location"),
                             (FourCC_INFO_PRT1, "Part"),
                             (FourCC_INFO_PRT2, "Number Of Parts"),
                             (FourCC_INFO_RATE, "Rate"),
                             (FourCC_INFO_STAR, "Starring"),
                             (FourCC_INFO_STAT, "Statistics"),
                             (FourCC_INFO_TAPE, "Tape Name"),
                             (FourCC_INFO_TCDO, "End Timecode"),
                             (FourCC_INFO_TCOD, "Start Timecode"),
                             (FourCC_INFO_TITL, "Title"),
                             (FourCC_INFO_TLEN, "Length (ms)"),
                             (FourCC_INFO_TORG, "Organization"),
                             (FourCC_INFO_TRCK, "Track Number"),
                             (FourCC_INFO_TURL, "URL"),
                             (FourCC_INFO_TVER, "Version"),
                             (FourCC_INFO_VMAJ, "Vegas Version Major"),
                             (FourCC_INFO_VMIN, "Vegas Version Minor"),
                             (FourCC_INFO_YEAR, "Year")])
riffFormTypeNames = toTable([(FourCC_ACON, "Windows NT Animated Cursor Format"),
                             (FourCC_AVI, "Audio Vide Interleave Format"),
                             (FourCC_BND, "Bundle File Format Format"), (
    FourCC_DIB, "Device Independent Bitmap File Format"),
                             (FourCC_RDIB, "RIFF DIB File Format"), (
    FourCC_MIDI, "Musical Instrument Digital Interface File Format"),
                             (FourCC_RMID, "RIFF MIDI File Format"),
                             (FourCC_PAL, "Palette File Format"),
                             (FourCC_RTF, "Rich Text Format"),
                             (FourCC_WAVE, "Waveform Audio File Format")])

Consts

FourCC_ACON = "ACON"
Windows NT Animated Cursor
FourCC_AVI = "AVI "
Audio Vide Interleave
FourCC_BND = "BND "
Bundle File Format (file contains a series of RIFF chunks)
FourCC_CGRP = "CGRP"
compound file element group (unsupported)
FourCC_CSET = "CSET"
defines the character-set and language used in the file (Latin-1 is assumed if not specified)
FourCC_CTOC = "CTOC"
compound file table of contents (unsupported)
FourCC_DIB = "DIB "
Device Independent Bitmap File Format
FourCC_DISP = "DISP"
display chunk, contains easy to representation of the data
FourCC_INFO = "INFO"
metadata about the file
FourCC_INFO_AGES = "AGES"
FourCC_INFO_CMNT = "CMNT"
FourCC_INFO_CODE = "CODE"
FourCC_INFO_COMM = "COMM"
FourCC_INFO_DIRC = "DIRC"
FourCC_INFO_DISP = "DISP"
FourCC_INFO_DTIM = "DTIM"
FourCC_INFO_GENR = "GENR"
FourCC_INFO_IARL = "IARL"
FourCC_INFO_IART = "IART"
FourCC_INFO_IAS1 = "IAS1"
FourCC_INFO_IAS2 = "IAS2"
FourCC_INFO_IAS3 = "IAS3"
FourCC_INFO_IAS4 = "IAS4"
FourCC_INFO_IAS5 = "IAS5"
FourCC_INFO_IAS6 = "IAS6"
FourCC_INFO_IAS7 = "IAS7"
FourCC_INFO_IAS8 = "IAS8"
FourCC_INFO_IAS9 = "IAS9"
FourCC_INFO_IBSU = "IBSU"
FourCC_INFO_ICAS = "ICAS"
FourCC_INFO_ICDS = "ICDS"
FourCC_INFO_ICMS = "ICMS"
FourCC_INFO_ICMT = "ICMT"
FourCC_INFO_ICNM = "ICNM"
FourCC_INFO_ICNT = "ICNT"
FourCC_INFO_ICOP = "ICOP"
FourCC_INFO_ICRD = "ICRD"
FourCC_INFO_ICRP = "ICRP"
FourCC_INFO_IDIM = "IDIM"
FourCC_INFO_IDIT = "IDIT"
FourCC_INFO_IDPI = "IDPI"
FourCC_INFO_IDST = "IDST"
FourCC_INFO_IEDT = "IEDT"
FourCC_INFO_IENC = "IENC"
FourCC_INFO_IENG = "IENG"
FourCC_INFO_IGNR = "IGNR"
FourCC_INFO_IKEY = "IKEY"
FourCC_INFO_ILGT = "ILGT"
FourCC_INFO_ILGU = "ILGU"
FourCC_INFO_ILIU = "ILIU"
FourCC_INFO_ILNG = "ILNG"
FourCC_INFO_IMBI = "IMBI"
FourCC_INFO_IMBU = "IMBU"
FourCC_INFO_IMED = "IMED"
FourCC_INFO_IMIT = "IMIT"
FourCC_INFO_IMIU = "IMIU"
FourCC_INFO_IMUS = "IMUS"
FourCC_INFO_INAM = "INAM"
FourCC_INFO_IPDS = "IPDS"
FourCC_INFO_IPLT = "IPLT"
FourCC_INFO_IPRD = "IPRD"
FourCC_INFO_IPRO = "IPRO"
FourCC_INFO_IRIP = "IRIP"
FourCC_INFO_IRTD = "IRTD"
FourCC_INFO_ISBJ = "ISBJ"
FourCC_INFO_ISFT = "ISFT"
FourCC_INFO_ISGN = "ISGN"
FourCC_INFO_ISHP = "ISHP"
FourCC_INFO_ISMP = "ISMP"
FourCC_INFO_ISRC = "ISRC"
FourCC_INFO_ISRF = "ISRF"
FourCC_INFO_ISTD = "ISTD"
FourCC_INFO_ISTR = "ISTR"
FourCC_INFO_ITCH = "ITCH"
FourCC_INFO_IWMU = "IWMU"
FourCC_INFO_IWRI = "IWRI"
FourCC_INFO_LANG = "LANG"
FourCC_INFO_LOCA = "LOCA"
FourCC_INFO_PRT1 = "PRT1"
FourCC_INFO_PRT2 = "PRT2"
FourCC_INFO_RATE = "RATE"
FourCC_INFO_STAR = "STAR"
FourCC_INFO_STAT = "STAT"
FourCC_INFO_TAPE = "TAPE"
FourCC_INFO_TCDO = "TCDO"
FourCC_INFO_TCOD = "TCOD"
FourCC_INFO_TITL = "TITL"
FourCC_INFO_TLEN = "TLEN"
FourCC_INFO_TORG = "TORG"
FourCC_INFO_TRCK = "TRCK"
FourCC_INFO_TURL = "TURL"
FourCC_INFO_TVER = "TVER"
FourCC_INFO_VMAJ = "VMAJ"
FourCC_INFO_VMIN = "VMIN"
FourCC_INFO_YEAR = "YEAR"
FourCC_JUNK = "JUNK"
represents padding, filler or no relevant data
FourCC_LIST = "LIST"
LIST chunk, may contain subchunks
FourCC_MIDI = "MIDI"
Musical Instrument Digital Interface File Format
FourCC_PAD = "PAD "
represents padding, filler or no relevant data (if the pad chunk makes the next chunk align on a 2k boundary, this padding must be preserved when modifying the file)
FourCC_PAL = "PAL "
Palette File Format
FourCC_RIFF = "RIFF"
RIFF chunk (little endian), may contain subchunks
FourCC_RIFX = "RIFX"
RIFX chunk (big endian), may contain subchunks
FourCC_RMID = "RMID"
RIFF MIDI File Format
FourCC_RTF = "RTF "
Rich Text Format
FourCC_WAVE = "WAVE"
Waveform Audio File Format

Procs

proc beginChunk(rw: RiffWriter; chunkId: string) {.
    ...raises: [RiffWriteError, RiffReadError, ValueError, IOError],
    tags: [WriteIOEffect], forbids: [].}
proc beginListChunk(rw: RiffWriter; formatTypeId: string) {.
    ...raises: [RiffWriteError, RiffReadError, ValueError, IOError],
    tags: [WriteIOEffect], forbids: [].}
proc close(rr: RiffReader) {....raises: [RiffReadError, IOError], tags: [],
                             forbids: [].}

Closes the RIFF file.

Raises a RiffReadError if the reader is closed or not initialised.

Raises an IOError if the file cannot be closed.

proc close(rw: RiffWriter) {....raises: [RiffWriteError, IOError, ValueError],
                             tags: [WriteIOEffect], forbids: [].}

Closes all currently open chunks (by calling endChunk()), updates the size of the root RIFF chunk, and closes the RIFF writer.

It is very important to call this method at the end to ensure that all chunk sizes are correctly updated in the file!

Raises a RiffReadError if the writer is closed or not initialised.

proc createRiffFile(filename: string; formTypeId: string; endian = littleEndian;
                    bufSize: int = -1): RiffWriter {.
    ...raises: [IOError, ValueError, RiffWriteError, RiffReadError],
    tags: [WriteIOEffect], forbids: [].}
proc currentChunk(rr: RiffReader): ChunkInfo {....raises: [RiffReadError],
    tags: [], forbids: [].}
proc cursor(rr: RiffReader): Cursor {....raises: [RiffReadError, IOError],
                                      tags: [], forbids: [].}

Returns a cursor that points the current chunk and chunk offset.

Raises a RiffReadError if the reader is closed or not initialised.

Raises an IOError on read errors.

proc cursor=(rr: RiffReader; c: Cursor) {....raises: [RiffReadError, IOError],
    tags: [], forbids: [].}

Restores the current chunk and chunk offset from a cursor.

Raises a RiffReadError if the reader is closed or not initialised.

Raises an IOError on read errors.

proc endChunk(rw: RiffWriter) {....raises: [RiffWriteError, IOError, ValueError],
                                tags: [WriteIOEffect], forbids: [].}
Raises a RiffReadError if the writer is closed or not initialised.
proc endian(rr: RiffReader): Endianness {....raises: [RiffReadError], tags: [],
    forbids: [].}

Returns the endianness of the RIFF file.

Raises a RiffReadError if the reader is closed or not initialised.

func endian(rw: RiffWriter): Endianness {....raises: [RiffWriteError], tags: [],
    forbids: [].}

Returns the endianness of the RIFF file associated with the reader.

Raises a RiffReadError if the writer is closed or not initialised.

proc enterGroup(rr: RiffReader): ChunkInfo {.
    ...raises: [RiffReadError, ValueError, IOError, Exception],
    tags: [ReadIOEffect], forbids: [].}
Raises a RiffReadError if the current chunk is not a group chunk, or if the reader is closed or not initialised.
proc exitGroup(rr: RiffReader) {....raises: [RiffReadError, ValueError], tags: [],
                                 forbids: [].}

Sets the current chunk to the parent group chunk.

Raises a RiffReadError if we're at the root level RIFF group chunk, or if the reader is closed or not initialised.

proc filename(rr: RiffReader): string {....raises: [RiffReadError], tags: [],
                                        forbids: [].}

Returns the filename of the RIFF file.

Raises a RiffReadError if the reader is closed or not initialised.

func filename(rw: RiffWriter): string {....raises: [RiffWriteError], tags: [],
                                        forbids: [].}

Returns the name of the file associated with the reader. If the reader was initialised from a file handle, the filename will be an empty string.

Raises a RiffReadError if the writer is closed or not initialised.

proc formTypeId(rr: RiffReader): string {....raises: [RiffReadError], tags: [],
    forbids: [].}
Returns the form type ID of the RIFF file (this indicates the concrete format of the file, e.g. "WAVE" or "AVI "). Raises a RiffReadError if the reader is closed or not initialised.
proc fourCCToCharStr(fourCC: string): string {....raises: [ValueError], tags: [],
    forbids: [].}

Converts a FourCC to a printable string.

fourCCToCharStr("RIFF")     # returns "('R', 'I', 'F', 'F')"
fourCCToCharStr("A#\27 ")   # returns "('A', '#', '\\27', ' ')"

proc getChunkPos(rr: RiffReader): uint32 {....raises: [RiffReadError, IOError],
    tags: [], forbids: [].}

Returns the current chunk position. The start of the chunk data (the first byte after the chunk headers) is the zero position.

Raises a RiffReadError if the reader is closed or not initialised.

Raises an IOError on read errors.

proc getFilePos(rr: RiffReader): int64 {....raises: [RiffReadError, IOError],
    tags: [], forbids: [].}

Returns the current absolute file position.

Raises a RiffReadError if the reader is closed or not initialised.

Raises an IOError on read errors.

proc hasNextChunk(rr: RiffReader): bool {....raises: [RiffReadError], tags: [],
    forbids: [].}

Returns true if there are more sibling subchunks under the current parent group chunk.

Raises a RiffReadError if the reader is closed or not initialised.

proc hasSubchunks(rr: RiffReader): bool {....raises: [], tags: [], forbids: [].}
proc nextChunk(rr: RiffReader): ChunkInfo {.
    ...raises: [RiffReadError, IOError, Exception], tags: [ReadIOEffect],
    forbids: [].}

Moves the current chunk pointer to the next sibling subchunk of the current parent group chunk, and sets the chunk offset to zero.

Raises a RiffReadError if we're at the last subchunk of the current group chunk, or if an invalid FourCC has been encountered, or if the reader is closed or not initialised.

Raises an IOError on read errors.

proc openRiffFile(f: File; bufSize: int = -1): RiffReader {.
    ...raises: [RiffReadError, ValueError, IOError], tags: [ReadIOEffect],
    forbids: [].}

Opens a RIFF file from an existing file handle. Optionally overrides the default bufSize of the underlying binary stream reader. The endianness of the file is determined from the RIFF headers.

Raises a RiffReadError if the file is not a valid RIFF file.

Raises an IOError if the file cannot be opened.

proc openRiffFile(filename: string; bufSize: int = -1): RiffReader {.
    ...raises: [IOError, ValueError, RiffReadError], tags: [ReadIOEffect],
    forbids: [].}

Opens a RIFF file specified by filename. Optionally overrides the default bufSize of the underlying binary stream reader. The endianness of the file is determined from the RIFF headers.

Raises a RiffReadError if the file is not a valid RIFF file.

Raises an IOError if the file cannot be opened.

proc read(rr: RiffReader; T: typedesc[RiffPrimitives]): T:type

Reads a numeric value; the type needs to be passed in as an argument.

let i8 = r.read(uint8)
let f32 = r.read(float32)
let i64 = r.read(int64)

Raises a RiffReadError if the reader is closed or not initialised, or if an attempt has been made to read past the end of the chunk.

Raises an IOError on read errors.

proc read[T: RiffPrimitives](rr: RiffReader; buf: var openArray[T];
                             startIndex, numValues: Natural)

Reads numValues number of values into buf starting from startIndex.

Raises a RiffReadError if the reader is closed or not initialised, or if an attempt has been made to read past the end of the chunk.

Raises an IOError on read errors.

proc readBStr(rr: RiffReader): string {....raises: [RiffReadError, ValueError,
    IOError], tags: [ReadIOEffect], forbids: [].}

Reads a Pascal-style string (one length leading byte followed by length bytes of character data).

Raises a RiffReadError if the reader is closed or not initialised, or if an attempt has been made to read past the end of the chunk.

Raises an IOError on read errors.

proc readBZStr(rr: RiffReader): string {.
    ...raises: [RiffReadError, ValueError, IOError], tags: [ReadIOEffect],
    forbids: [].}

Reads a Pascal-style string (one length leading byte followed by length bytes of character data), that is also null-terminated.

Raises a RiffReadError if the reader is closed or not initialised, or if an attempt has been made to read past the end of the chunk.

Raises an IOError on read errors.

proc readChar(rr: RiffReader): char {....raises: [RiffReadError, ValueError,
    IOError], tags: [ReadIOEffect], forbids: [].}

Reads a char.

Raises a RiffReadError if the reader is closed or not initialised, or if an attempt has been made to read past the end of the chunk.

Raises an IOError on read errors.

proc readFourCC(rr: RiffReader): string {.
    ...raises: [RiffReadError, ValueError, IOError], tags: [ReadIOEffect],
    forbids: [].}

Reads the next 4-bytes as a FourCC string. It does not validate the FourCC.

Raises a RiffReadError if the reader is closed or not initialised, or if an attempt has been made to read past the end of the chunk.

Raises an IOError on read errors.

proc readStr(rr: RiffReader; length: Natural): string {.
    ...raises: [RiffReadError, ValueError, IOError], tags: [ReadIOEffect],
    forbids: [].}

Reads length number of bytes as an UTF-8 string.

Raises a RiffReadError if the reader is closed or not initialised, or if an attempt has been made to read past the end of the chunk.

Raises an IOError on read errors.

proc readWStr(rr: RiffReader): string {....raises: [RiffReadError, ValueError,
    IOError], tags: [ReadIOEffect], forbids: [].}

Reads a Pascal-style string (one length leading word (16-bit int) followed by length bytes of character data).

Raises a RiffReadError if the reader is closed or not initialised, or if an attempt has been made to read past the end of the chunk.

Raises an IOError on read errors.

proc readWZStr(rr: RiffReader): string {.
    ...raises: [RiffReadError, ValueError, IOError], tags: [ReadIOEffect],
    forbids: [].}

Reads a Pascal-style string (one length leading word (16-bit int) followed by length bytes of character data), that is also null-terminated.

Raises a RiffReadError if the reader is closed or not initialised, or if an attempt has been made to read past the end of the chunk.

Raises an IOError on read errors.

proc readZStr(rr: RiffReader): string {....raises: [RiffReadError, ValueError,
    IOError], tags: [ReadIOEffect], forbids: [].}

Read a C-style null-terminated string.

Raises a RiffReadError if the reader is closed or not initialised, or if an attempt has been made to read past the end of the chunk.

Raises an IOError on read errors.

proc setChunkPos(rr: RiffReader; pos: int64; relativeTo: ChunkSeekPos = cspSet) {.
    ...raises: [RiffReadError, IOError, ValueError], tags: [], forbids: [].}

Sets the current chunk position according to the relativeTo parameter.

Raises a RiffReadError if the reader is closed or not initialised.

Raises an IOError on read errors.

proc validFourCC(fourCC: string; relaxed: bool = false): bool {....raises: [],
    tags: [], forbids: [].}
Returns true is the passed in FourCC is valid. A FourCC is valid if:
  • it is 4 ASCII characters long
  • it only contains alphanumeric ASCII characters or spaces
  • spaces are only allowed in trailing position

If the relaxed flag is set to true, all ASCII characters are allowed (but the trailing spaces only rule still applies).

proc write[T: RiffPrimitives](rw: RiffWriter; buf: var openArray[T];
                              startIndex, numValues: Natural)
Raises a RiffReadError if the writer is closed or not initialised.
proc write[T: RiffPrimitives](rw: RiffWriter; value: T)
Raises a RiffReadError if the writer is closed or not initialised.
proc writeBStr(rw: RiffWriter; s: string) {.
    ...raises: [RiffWriteError, IOError, ValueError], tags: [WriteIOEffect],
    forbids: [].}
proc writeBZStr(rw: RiffWriter; s: string) {.
    ...raises: [RiffWriteError, IOError, ValueError], tags: [WriteIOEffect],
    forbids: [].}
proc writeChar(rw: RiffWriter; c: char) {.
    ...raises: [RiffWriteError, IOError, ValueError], tags: [WriteIOEffect],
    forbids: [].}
Raises a RiffReadError if the writer is closed or not initialised.
proc writeFourCC(rw: RiffWriter; fourCC: string) {.
    ...raises: [RiffWriteError, IOError, ValueError], tags: [WriteIOEffect],
    forbids: [].}
Raises a RiffReadError if the writer is closed or not initialised.
proc writeStr(rw: RiffWriter; s: string) {.
    ...raises: [RiffWriteError, IOError, ValueError], tags: [WriteIOEffect],
    forbids: [].}
Raises a RiffReadError if the writer is closed or not initialised.
proc writeWStr(rw: RiffWriter; s: string) {.
    ...raises: [RiffWriteError, IOError, ValueError], tags: [WriteIOEffect],
    forbids: [].}
proc writeWZStr(rw: RiffWriter; s: string) {.
    ...raises: [RiffWriteError, IOError, ValueError], tags: [WriteIOEffect],
    forbids: [].}
proc writeZStr(rw: RiffWriter; s: string) {.
    ...raises: [RiffWriteError, IOError, ValueError], tags: [WriteIOEffect],
    forbids: [].}

Iterators

iterator walkChunks(rr: RiffReader): ChunkInfo {.closure,
    ...raises: [RiffReadError, IOError, ValueError, Exception],
    tags: [ReadIOEffect], forbids: [].}