6.4. Which sort of file should I use?
Prev | Chapter 6. Plain text Foods files, and choosing which type of Foods file to use | Next

## 6.4. Which sort of file should I use?

Thus, there are three different file formats that do similar things: keep Pantry foods. You might be wondering which one you should use.

Each file format has advantages and disadvantages. The Pantry native file is the fastest one for Pantry to work with, but it cannot be edited with a text editor. The Pantry XML file is plain-text, but Pantry takes some time to open it and to write changes to it because it is XML. The Foods Text file is also plain-text, and very easy to edit, but it does not hold all the data needed for a food and so it must rely on source files.

I find it best to use a Foods Text file for my diaries. It is remarkably easy to edit, which makes it easy to fix mistakes. It's also easiest to reorder foods in a Foods Text file; then I can easily sort the reports using the `--sort o` option. It's also possible to assign the order trait to foods in other files using the `--c-order` option, but that is more cumbersome.

For files that will contain many foods, such as a `master` file, I use a Pantry native file because it is the speediest. Of course, when adding entirely new foods with new nutrient information, my only choice is to use a Pantry XML file.[17] I otherwise avoid Pantry XML files because XML is a bit cumbersome to edit.

I also keep a `quick` file for easy access to the foods I use often. I keep this in a Pantry native file, but if your `quick` file is relatively short (under a couple of hundred foods, say) there's no reason not to use a Foods Text file for this (except for the fact that you'll have to make sure it stays harmonized with the source file--that is, you have to ensure that the foods that the Foods Text file looks up in the source file remain in the source file.)[18]

[17] I have considered making a way to add entirely new foods using the Pantry command-line interface, but I don't see how much of a benefit this would be.

[18] Here is as good a place as any to point out that there is yet another Pantry file format: the Foods Zip file. This is what I use to import the SR data from the Zip file that USDA provides. If you are curious, you can download the full plain-text version and run something like `pantry --add master sr19.zip` to make your very own `master` file. I can't guarantee that this will work with any releases subsequent to SR 19, and it takes lots of RAM too (about 200 MB, maybe.)

Prev | Up | Next
6.3. Using Foods Text files | Home | Chapter 7. Adding recipes