Skip to content

Access files within a zone from the global zone

License

Notifications You must be signed in to change notification settings

isabella232/node-zfile

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Synopsis

The node-zfile library provides a means of access to a stream (or file-descriptor) to a file within a zone (from the global zone).

The reasoning behind is to provide a safe method to read the contents of a file without needing to worry about atomically checking for potentially malicious symlinks (and such).

Example Usage

To use the library to get a readable file-stream:

var zfile = require('zfile');

var myPath = '/etc/passwd';

zfile.createZoneFileStream(
    {zone: self.zone, path: myPath},
    onZFileStream);

function onZFileStream(err, stream) {
    stream.pipe(process.stdout);
    stream.resume();
}

To use the library to get a file descriptor to file:

var zfile = require('zfile');

var myPath = '/etc/passwd';

zfile.getZoneFileDescriptor(
    {zone: self.zone, path: myPath, mode: 'w'},
    onZFileDescriptor);

function onZFileDescriptor(err, fd) {
    // ...
}

The optional paramater 'mode' can be 'r', 'w', or 'a' and defaults 'r' if not explicitly specified.

Installation

git clone http://github.com/joyent/node-zfile
cd node-zfile
node-waf configure build

License

MPL-2.0

Credits

This addon is based on the node-zsock addon by the venerable Mark Cavage. See https://github.com/mcavage/node-zsock

About

Access files within a zone from the global zone

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 53.1%
  • JavaScript 30.3%
  • Python 9.4%
  • Makefile 7.2%