Perforce Public Knowledge Base - Perforce File Type Options
Perforce Software logo
Reset Search



Perforce File Type Options

« Go Back



What Perforce filetypes should I use?


Automatic File Type Detection

The Perforce Server identifies binary and text files based on whether it detects non-text characters in the first 8192 bytes of the file. Revisions of binary files are stored intact, but text files are diffed with the previous revision and only the changes (the "deltas") are stored.

Overriding Automatic File Type Detection

To override the Perforce file type detection logic when required, you can map operating system file types to Perforce file types using the p4 typemap feature. For example, Postscript files are textual in format, but because diffs between revisions are not useful and diffing huge Postscript files can adversely affect server performance, you can use p4 typemap to specify that Postscript files be stored as type binary, which are not diffed by default.

If you want to tell the Perforce server to regard all PDF files in the root directory as binary, for example, you would enter the following command on the command line:

p4 typemap

The above command opens the typemap table. Modify the table to include the following line:

binary //....pdf

All PDF files under the root directory are subsequently treated as binary files by the Perforce server.

Basic File Typing Guidelines

Some basic guidelines for assigning file types:

  • If the file is textual and can be meaningfully diffed, store it as text.
    Example: README files.
  • If the file is textual but cannot be meaningfully diffed, choose binary or text+C
    Example: Large application-generated text files, Postscript files.


Acrobat (PDF) files

If you store PDF files in your depot, map them to the binary file type. PDF files have a textual header that can cause old (pre-2000.1) Perforce clients to identify them as text files.

Avoiding Accidental File Truncation

Some operating systems (notably Windows), interpret the Control-Z character (decimal 26 or hex 0x1a) as the end of a file. To prevent inadvertent truncation, never store binary file content as text.

Very Large Text Files

Some programs generate very large text files. For example, certain chip design files can have file sizes up to 100MB. In general, storing text files over 2MB in RCS format is inefficient. Such large text files should generally be stored as compressed text (text+C) to avoid the overhead of computing deltas when editing files or accessing old revisions.

Common File Types

The following table lists some recommended Perforce file types and attributes for common file types.

Extension Perforce file typeDescription
.asptextActive server page file
.avibinary+FVideo for Windows file
.bmpbinaryWindows bitmap file
.btrbinaryBtrieve database file
.cnftextConference link file
.csstextCascading style sheet file
.docbinaryMicrosoft Word document
.dotbinaryMicrosoft Word template
.expbinary+wExport file (Microsoft Visual C++)
.gifbinary+FGIF graphic file
.htmtextHTML file
.htmltextHTML file
.icobinaryIcon file
.inctextActive Server include file
.initext+wInitial application settings file
.jpgbinaryJPEG graphic file
.jstextJavaScript language source code file
.libbinary+wLibrary file (several programming languages)
.logtext+wLog file
.mpgbinary+FMPEG video file
.pdfbinaryAdobe PDF file
.pdmtext+wSybase Power Designer file
.pptbinaryMicrosoft Powerpoint file
.xlsbinary+wMicrosoft Excel file
.zipbinary+FCompressed archive file
.jarbinaryJava Archive
.warbinaryWeb Application Archive
.rarbinaryResource Adapter Archive
.earbinaryEnterprise Archive


Additional Resources

For more information about Perforce file types, including handling of Unicode files, please refer to Appendix B of the P4 User's Guide.

For more information about using p4 typemap, refer to the Perforce Command Reference and the Perforce System Administrator's Guide.



Related Links



Was this article helpful?



Please tell us how we can make this article more useful.

Characters Remaining: 255