GithubHelp home page GithubHelp logo

scality / node-nfsc Goto Github PK

View Code? Open in Web Editor NEW
14.0 68.0 6.0 180 KB

NFS client bindings for NodeJS

License: Apache License 2.0

Python 0.87% C++ 64.00% C 2.37% Shell 0.19% Logos 9.33% JavaScript 23.24%

node-nfsc's Introduction

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.

node-nfsc's People

Contributors

ploki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-nfsc's Issues

Installation fails after trying to install through npm

Even installing the dependencies, the installation stalls the following error :

npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning ECONNRESE`` T: request to https://registry.npmjs.org/node-nfsc failed, reason: read ECONNRESET npm WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.`

> [email protected] install /usr/lib/node_modules/node-nfsc
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/10.12.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/node-nfsc/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/node-nfsc/.node-gyp'
gyp ERR! System Linux 4.9.0-7-amd64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /usr/lib/node_modules/node-nfsc gyp ERR! node -v v10.12.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-11-12T19_05_32_320Z-debug.log

Any clue on why is this happening ?

Buffer size causes RPC_CANTENCODEARGS

I have this code:

new Promise((resolve, reject) => {
    client.create(dir_handler, filename, client.CREATE_GUARDED, { mode: 0o644 }, (err, object, obj_attrs) => {
        if (err) return reject(err);
        let transferred = 0;
        readStream = fs.createReadStream(src, { highWaterMark: 32 * 1024 });
        readStream.on('error', err => reject(err));
        readStream.on('close', () => resolve());
        readStream.on('data', buffer => {
            client.write(object, buffer.length, transferred, client.WRITE_UNSTABLE, buffer, (err, commited, count, verf, wcc) => {
                if (err) {
                    reject(err);
                    readStream.destroy();
                }
            });
            transferred += buffer.length;
        });
    });
})

Using default buffer size (64 * 1024) I always get this error:

Error: RPC_CANTENCODEARGS

However all goes perfectly fine with a buffer size of 32 *1024. I tried with intermediate sizes and, even though it does not fail, the target file ends up corrupted. And the problem with a 32Kb buffer is the speed, I don't manage to go above 5MB/s when the linux NFS client reaches 100 MB/s.

Am I doing something wrong with the client? Do you recomend any other way of using it?

Thanks!

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.