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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@amitosdev/s3-store-mock

v2.0.0

Published

Mock implementation of @kessler/s3-store using local file system

Readme

@amitosdev/s3-store-mock

A mock implementation of @kessler/s3-store that uses the local file system instead of AWS S3.

About

This package provides a drop-in replacement for @kessler/s3-store that stores data in local files instead of S3. Perfect for testing, local development, or offline work.

Installation

npm install @amitosdev/s3-store-mock @kessler/s3-store

Note: @kessler/s3-store is required as a peer dependency for the JSON wrapper functionality.

Usage

import createS3Store from '@amitosdev/s3-store-mock'
import { createJsonWrapper } from '@kessler/s3-store'

// Create a store (stores files in .s3StoreMock/my-bucket/ by default)
const store = createS3Store('my-bucket')

// Specify a custom directory name
const store = createS3Store('my-bucket', { mockDir: './my-custom-mock-dir' })

// Specify a custom base path (defaults to process.cwd())
const store = createS3Store('my-bucket', { basePath: '/custom/path' })

// Combine both options
const store = createS3Store('my-bucket', {
  mockDir: './my-custom-mock-dir',
  basePath: '/custom/path'
})

// Use the JSON wrapper for automatic JSON serialization
const jsonStore = createJsonWrapper(store)

// Create an object
const etag = await jsonStore.createObject('my-key', { hello: 'world' })

// Get an object
const [data, etag] = await jsonStore.getObject('my-key')
console.log(data) // { hello: 'world' }

// Update with etag
const newEtag = await jsonStore.putObjectIfMatch('my-key', { hello: 'universe' }, etag)

// Delete an object
await store.deleteObject('my-key')

// List objects
for await (const objects of store.list('prefix/')) {
  console.log(objects)
}

API

This mock implements the same API as @kessler/s3-store:

  • createObject(key, body, contentType) - Create a new object (fails if key exists)
  • putObjectIfMatch(key, body, etag, contentType) - Update object with etag validation
  • getObject(key) - Get object without etag check
  • getObjectIfMatch(key, etag) - Get object with etag validation
  • deleteObject(key) - Delete object
  • deleteObjectIfMatch(key, etag) - Delete object with etag validation
  • list(prefix) - Async iterator for listing objects

Testing

npm test

Configuration Options

  • mockDir (default: .s3StoreMock) - The directory name where mock data is stored
  • basePath (default: process.cwd()) - The base path where the mockDir will be created

How It Works

  • Files are stored in {basePath}/{mockDir}/{bucket}/{key} (defaults to .s3StoreMock/{bucket}/{key} in current directory)
  • ETags are calculated using MD5 hashes and wrapped in double quotes (e.g., "6805f2cfc46c0f04559748bb039d69ae")
  • Metadata (ETags, content type) is stored in .meta files alongside the data files
  • All the same errors are thrown (KeyExistsError, StaleDataError, etc.)
  • List results match AWS S3 format with all properties: Key, LastModified, ETag, Size, StorageClass, and Owner
  • Error handling follows AWS SDK patterns - only expected errors (e.g., ENOENT) are caught, unexpected errors (permissions, corruption, etc.) are properly thrown

Original Module

This is a mock implementation of @kessler/s3-store. For production use with real AWS S3, please use the original module.

License

Apache-2.0