I know that resource forks are deprecated in Mac OS X.
It's not clear whether the less well known and little used named forks are also deprecated. HFS+ actually supports an arbitrary number of arbitrary length forks for any file. (Mac's named forks are conceptually similar to Windows's alternate data streams or "ADS".)
Deprecated or not there's still reasons to learn about creating, enumerating, removing, and otherwise manipulating file forks.
Yet I can't seem to find anything about the APIs for working with forks.
All I can find is that from the terminal and perhaps other places that accept filenames or paths you can access the resource fork with the syntax <filename>/..namedfork/rsrc
and until recently also <filename>/rsrc
. I have tried replacing rsrc
with other names but all the commands I tried in the terminal failed.
Where can I find old or unofficial documentation on the APIs to work with named forks in OS X programatically?
By the way there seems to be a common misunderstanding on the internet when Googling this topic. Random punters are saying that named forks are built on named file attributes. This is not so. Named file attributes are a fairly new OS X feature. Named forks predate OS X. It seems that in fact named file attributes could well be using named forks behind the scenes.
In any case, please don't submit answers about named file attributes. I am specifically seeking information on arbitrary named forks.
There is some description of named forks in section 12.7.4. "The Attributes File"
My old answer is wrong! Three years later there is now more information on the internet, including mirrors of old and deprecated Apple developer documentation.
Here's a selection of the APIs for named forks I've found:
Opening Files
FSOpenFork
Opens any fork of a file or directory for streaming access.PBOpenForkSync
Opens any fork of a file or directory for streaming access.PBOpenForkAsync
Opens any fork of a file or directory for streaming access.Creating and Deleting Named Forks
FSCreateFork
Creates a named fork for a file or directory.PBCreateForkSync
Creates a named fork for a file or directory.PBCreateForkAsync
Creates a named fork for a file or directory.FSDeleteFork
Deletes a named fork from a file or directory.PBDeleteForkSync
Deletes a named fork from a file or directory.PBDeleteForkAsync
Deletes a named fork of a file or directoryIterating Over Named Forks
FSIterateForks
Determines the name and size of every named fork belonging to a file or directory.PBIterateForksSync
Determines the name and size of every named fork belonging to a file or directory.PBIterateForksAsync
Determines the name and size of every named fork belonging to a file or directoryManipulating File and Fork Size
FSGetForkSize
Returns the size of an open fork.PBGetForkSizeSync
Returns the size of an open fork.PBGetForkSizeAsync
Returns the size of an open fork.FSSetForkSize
Changes the size of an open fork.PBSetForkSizeSync
Changes the size of an open fork.PBSetForkSizeAsync
Changes the size of an open fork.Core Services Framework Reference