fake-s3
a fake s3 server for testing purposes.
This is a zero dependency implementation that stores all objects
in memory
Example
var FakeS3 = require("fake-s3");
var server = new FakeS3({
buckets: ['my-bucket'],
prefix: 'files-i-care-about/'
})
await server.bootstrap()
server.hostPort
const files = await server.waitForFiles('my-bucket', 2)
await server.close()
Docs
var server = new FakeS3(options)
options.prefix
: prefix for getFiles()
and waitForFiles()
;
necessary to support multi part uploads, otherwise
waitForFiles()
will return too early when N parts have
been uploaded.options.buckets
: an array of buckets to create.
server.hostPort
This is the hostPort
that the server is listening on, this
will be non-null after bootstrap()
finishes.
await server.bootstrap()
starts the server
await getFiles(bucket)
gets all files in a bucket
await waitForFiles(bucket, count)
this will wait for file uploads to finish and calls getFiles()
and returns them once it's finished.
This is useful if your application does background uploads and you
want to be notified when they are finished.
await server.close()
closes the HTTP server.
Installation
npm install fake-s3
Tests
npm test
Contributors
MIT Licensed