npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@seedalpha/carbon

v2.1.13

Published

persistence layer

Downloads

6

Readme

Carbon

wercker status

seedalpha's persistence layer

In order to prevent mutation Seedalpha's infrastructure runs on a read-only filesystem. Carbon's role is to persist services output.

Changelog

2.1.3:

  • remove s3-streams

2.1.2:

  • update s3-writeable

2.1.1:

  • use s3-readable, s3-writeable

2.1.0:

  • expose carbon app / lib / standalone
  • integration tests
  • clean server
  • update docs

2.0.2:

  • setup npm to use NPM_AUTH
  • test coverage
  • streaming uploads / downloads

2.0.1:

  • ci integration

2.0.0:

  • Major API changes
  • Standalone use
  • Library use

Prerequisites (standalone)

  • NPM_AUTH

  • AUTH

  • PORT

  • AMAZON_ACCESS_KEY_ID

  • AMAZON_ACCESS_KEY_SECRET

  • S3_REGION

  • S3_BUCKET or

  • DATABASE_URL

Development

  $ git clone [email protected]:seedalpha/carbon.git
  $ cd carbon
  $ npm install
  $ npm test

Usage

# index.js

var Carbon = require('seed-carbon');

// persist in mongodb GridFS

var store = new Carbon({
  adapter: Carbon.MongoAdapter('mongodb://localhost:27017/carbon')
});

// or in AWS S3

var store = new Carobn({
  adapter: Carbon.S3Adapter({
    key: AWS_ACCESS_KEY_ID,
    secret: AWS_ACCESS_KEY_SECRET,
    region: 'ap-southeast-1',
    bucket: 'carbon'
  })
});

// API

store.put({
  filename: 'research.pdf',
  contentType: 'application/pdf',
  stream: fs.createReadStream('./research.pdf')
}, function(error){ });

store.get('research.pdf', function(error, file) {
  file.length
  file.filename
  file.contentType
  file.stream
});

store.remove('research.pdf', function(error) {});

Usage with express

# index.js

var express       = require('express);
var CarbonServer  = require('seed-carbon/server');

var config = {
  auth:   'abcd',
  key:    process.env.AMAZON_ACCESS_KEY_ID,
  secret: process.env.AMAZON_ACCESS_KEY_SECRET,
  region: process.env.S3_REGION,
  bucket: process.env.S3_BUCKET,
  // or
  db:     process.env.DATABASE_URL
};

var carbonServer  = CarbonServer(config);

var app = express();

app.use('/store', carbonServer);

app.listen(process.env.PORT || 5000);

// same as library usage
var store = carbonServer.carbon;

// $ curl -F file=some-file.txt http://127.0.0.1/store/some-file.txt

Standalone usage

$ git clone [email protected]:seedalpha/carbon.git
$ cd carbon

$ npm install

$ export PORT=5000
$ export AUTH=zzz
$ export DEBUG=carbon* # optional

$ # for S3
$ export AWS_ACCESS_KEY_ID=xxx
$ export AWS_ACCESS_KEY_SECRET=yyy
$ export S3_REGION=ap-southeast-1
$ export S3_BUCKET=carbon

$ # or for GridFS
$ export DATABASE_URL=mongodb://localhost:27017/carbon

$ npm start

# in a second shell
$ curl -XPOST -H 'Content-Type: application/pdf' --data-binary @spec/document.pdf http://127.0.0.1:5000/document.pdf
$ curl -F file=@spec/document.pdf http://127.0.0.1:5000/document.pdf
$ open http://127.0.0.1:5000/document.pdf # should open in a reader

Author

Vladimir Popov [email protected]

License

©2014 Seedalpha