Skip to content

Commit

Permalink
Argh, more README tweaks [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Aug 2, 2015
1 parent c72c2b2 commit 97d63af
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,26 @@ file format.

## Adding new formats

You register a new format by calling `addformat(fmt, magic,
You register a new format by calling `add_format(fmt, magic,
extension)`. `fmt` is a `DataFormat` type, most conveniently created
as `format"IDENTIFIER"`. `magic` typically contains the magic bytes
that identify the format. Here are some examples:

```jl
# A straightforward format
addformat(format"PNG", [0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a], ".png")
add_format(format"PNG", [0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a], ".png")

# A format that uses only ASCII characters in its magic bytes, and can
# have one of two possible file extensions
addformat(format"NRRD", "NRRD", [".nrrd",".nhdr"])
add_format(format"NRRD", "NRRD", [".nrrd",".nhdr"])

# A format whose magic bytes might not be at the beginning of the file,
# necessitating a custom function `detecthdf5` to find them
addformat(format"HDF5", detecthdf5, [".h5", ".hdf5"])
add_format(format"HDF5", detecthdf5, [".h5", ".hdf5"])

# A fictitious format that, unfortunately, provides no magic
# bytes. Here we have to place our faith in the file extension.
addformat(format"DICEY", (), ".dcy")
add_format(format"DICEY", (), ".dcy")
```

You can also declare that certain formats require certain packages for
Expand Down

0 comments on commit 97d63af

Please sign in to comment.