The O_* constants are documented in `man 2 open`.  The S_* constants
are documented in `man 2 stat`.

Note that they're also platform-dependent.  For example, O_SYMLINK
only exists on BSD systems.


On Sat, May 19, 2012 at 11:00 PM, Adam Crabtree <atcrabt...@gmail.com> wrote:
> Howdy all,
>
> (Let me know if this isn't appropriate for nodejs-dev.)
>
> I'm attempting to porting fs to the browser in browserify via the FileSystem
> API, and it looks like the fastest route is to shim the appropriate
> process.binding('fs') and process.binding('constants'), which includes:
>
> // from process.binding('fs')
> [ 'Stats',
>   'close',
>   'open',
>   'read',
>   'fdatasync',
>   'fsync',
>   'rename',
>   'truncate',
>   'rmdir',
>   'mkdir',
>   'sendfile',
>   'readdir',
>   'stat',
>   'lstat',
>   'fstat',
>   'link',
>   'symlink',
>   'readlink',
>   'unlink',
>   'write',
>   'chmod',
>   'fchmod',
>   'chown',
>   'fchown',
>   'utimes',
>   'futimes',
>   'StatWatcher' ]
>
> // from process.binding('constants')
> {
> O_RDONLY: 0,
>   O_WRONLY: 1,
>   O_RDWR: 2,
>   S_IFMT: 61440,
>   S_IFREG: 32768,
>   S_IFDIR: 16384,
>   S_IFCHR: 8192,
>   S_IFBLK: 24576,
>   S_IFIFO: 4096,
>   S_IFLNK: 40960,
>   S_IFSOCK: 49152,
>   O_CREAT: 512,
>   O_EXCL: 2048,
>   O_NOCTTY: 131072,
>   O_TRUNC: 1024,
>   O_APPEND: 8,
>   O_DIRECTORY: 1048576,
>   O_NOFOLLOW: 256,
>   O_SYNC: 128,
>   O_SYMLINK: 2097152
> }
>
> The fs bindings seem pretty straightforward, not sure if they'll all
> translate to the FileSystem API, but mostly if anyone would be be willing to
> give information on the constants I'd be very thankful.
>
> Also, are these documented outside of the source?
>
> Cheers,
> Adam Crabtree
>
> --
> Better a little with righteousness
>        than much gain with injustice.
> Proverbs 16:8

Reply via email to