Giter Site home page Giter Site logo

bryce-gibson / node-mantafs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tritondatacenter/node-mantafs

0.0 1.0 0.0 239 KB

`fs` compatible API that caches objects and directories in Joyent Manta

License: Mozilla Public License 2.0

Makefile 1.07% JavaScript 98.93%

node-mantafs's Introduction

mantafs

mantafs provides an API for interacting with Joyent Mantathat is drop-in compatible with node's fs API. This API automatically manages interactions with Manta by maintaining a local on-disk cache; this will give you a dramatic performance increase (since in most cases the WAN is avoided), at the cost of no longer being consistent at any point in time with your data in Manta (i.e., this is 'A' in CAP).

Usage

As always:

npm install mantafs

Then to use:

var assert = require('assert');
var manta = require('manta');
var mantafs = require('mantafs');

var fs = mantafs.createClient({
    files: 10000,                // how many local files to keep
    path: '/var/tmp/mantafs',    // where to stash cached files
    sizeMB: 1000,                // how much disk space to consume
    ttl: 3600,                   // if no cache-control header, the default TTL
    manta: manta.createClient({  // must provide a Manta client
        sign: manta.privateKeySigner({
            key: fs.readFileSync(process.env.HOME + '/.ssh/id_rsa', 'utf8'),
            keyId: process.env.MANTA_KEY_ID,
            user: process.env.MANTA_USER
        }),
        user: process.env.MANTA_USER,
        url: process.env.MANTA_URL
    })
});


fs.once('ready', function () {
    fs.readdir('~~/stor', function (err, files) {
        assert.ifError(err);

        console.log(files);

        fs.close(function (err2) {
            assert.ifError(err2);
            manta.close();
        });
    });
});

node-mantafs's People

Contributors

jjelinek avatar mcavage avatar dwlf avatar

Watchers

 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.