Skip to content
This repository has been archived by the owner on Jan 17, 2022. It is now read-only.

scality/node-nfsc

Repository files navigation

logo

node-nfsc

CircleCI

tl;dr

NFS client bindings for node.js

Using node-nfsc in your project

Install the dependencies krb5-multidev and libkrb5-dev.

And then,

$ npm install --save node-nfsc

Usage

First, import the node-nfsc function into your program:

const nfsc = require('node-nfsc');

Second, create an NFSv3 Client instance with the following arguments:

var my_stash = new nfsc.V3({
    host: 'example.com',
    exportPath: '/my_stash'
});

Third, mount the filesystem and play with your data:

let myfile_content;
my_stash.mount((err, root) => {
    if (err) {
        console.log(err);
        return;
    }
    my_stash.lookup(root, 'mydir', (err, mydir, mydir_attrs, root_attrs) => {
        if (err) {
            console.log(err);
            return;
        }
        my_stash.lookup(mydir, 'myfile', (err, myfile, myfile_attrs, mydir_attrs) => {
            if (err) {
                console.log(err);
                return;
            }
            my_stash.read(myfile,
                          myfile_attrs.size, 0,
                          (err, eof, buffer, myfile_attrs) => {
                if (err) {
                    console.log(err);
                    return;
                }
                myfile_content = buffer;
            });
        });
    });
});

Contributing

In order to contribute, please follow the Contributing Guidelines.