GithubHelp home page GithubHelp logo

isabella232 / node-zfile Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tritondatacenter/node-zfile

0.0 0.0 0.0 201 KB

Access files within a zone from the global zone

License: Mozilla Public License 2.0

Python 9.45% Makefile 7.15% JavaScript 30.27% C++ 53.13%

node-zfile's Introduction

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

node-zfile's People

Contributors

orlandov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.