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

@makerstudios/s3rver

v1.1.0

Published

Fake S3 server for node

Downloads

3

Readme

S3rver

NPM

Build Status

S3rver is a lightweight server that responds to some of the same calls Amazon S3 responds to. It is extremely useful for testing S3 in a sandbox environment without actually making calls to Amazon.

The goal of S3rver is to minimise runtime dependencies and be more of a development tool to test S3 calls in your code rather than a production server looking to duplicate S3 functionality.

Supported methods

Buckets

  • Create bucket
  • Delete bucket
  • List buckets
  • List content of buckets (prefix, delimiter, marker and max keys, common prefixes)

Objects

  • Put object (support for metadata, including ContentEncoding (gzipped files)
  • Delete object(s)
  • Get object (including using the HEAD method)
  • Get dummy ACLs for an object
  • Copy object (including updating of metadata)

Quick Start

Install s3rver:

npm install s3rver -g

You will now have a command on your path called s3rver

Executing this command for the various options:

s3rver --help

Supported clients

Please see Fake S3s wiki page for a list of supported clients. When listening on HTTPS with a self-signed certificate, the AWS SDK in a Node.js environment will need httpOptions: { agent: new https.Agent({ rejectUnauthorized: false }) } in order to allow interaction.

Please test, if you encounter any problems please do not hesitate to open an issue :)

Static Website Hosting

If you specify an indexDocument then get requests will serve the indexDocument if it is found, simulating the static website mode of AWS S3. An errorDocument can also be set, to serve a custom 404 page.

Hostname Resolution

By default a bucket name needs to be given. So for a bucket called mysite.local, with an indexDocument of index.html. Visiting http://localhost:4568/mysite.local/ in your browser will display the index.html file uploaded to the bucket.

However you can also setup a local hostname in your /etc/hosts file pointing at 127.0.0.1

localhost 127.0.0.1
mysite.local 127.0.0.1

Now you can access the served content at http://mysite.local:4568/

Tests

When running the tests with node v0.10.0 the following error is encountered. This is resolved by running the tests with v0.11.*. I recommend using NVM to manage your node versions.

To run the test suite, first install the dependencies, then run npm test:

$ npm install
$ npm test

Programmatically running s3rver

You can also run s3rver programmatically.

This is particularly useful if you want to integrate s3rver into another projects tests that depends on access to an s3 environment

Example in mocha:

var S3rver = require('s3rver');
var client;

before(function (done) {
    client = new S3rver({
        port: 4569,
        hostname: 'localhost',
        silent: false,
        directory: '/tmp/s3rver_test_directory'
    }).run(function (err, host, port) {
        if(err) {
         return done(err);
        }
        done();
    });
});

after(function (done) {
    client.close(done);
});