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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@kessler/s3-store

v3.2.1

Published

a CRUD layer over s3 that utilizes conditional writes to maintain strong consistency for optimistic concurrency

Readme

@kessler/s3-store

a CRUD+extras layer over s3 that utilizes conditional reads and writes to maintain strong consistency for optimistic concurrency. Loosely based on this article

to create or access object, call createObject or getObject. Both will return an etag that you can use to putObjectIfMatch later.

The etag is a strong consistency token that you can use to ensure that the object has not been modified since you last read it.

Please note that an putObjectIfMatch is a full overwrite of the object. However, in most cases you should already have a copy of the object in memory, so you can just modify it and call putObjectIfMatch with the new object. The call will fail if the object has been modified since you last read it, which is the desired behavior. In that case all you need to do is to read the object again, modify it and call putObjectIfMatch again. This is of course a technical action, rather than a product one. In real world use cases you will maybe want to notify the user that the object has been modified and ask them to confirm the changes.

installation

npm install @kessler/s3-store

usage

conveniece / simplified API for json objects

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

const store = createJsonWrapper(createS3Store('my-bucket'))
const key = 'test-object'

const object = { hello: 'world' }
const createTag = await store.createObject(key, object)
const updateTag = await store.putObjectIfMatch(key, {...object, foo: 'bar '}, createTag)

// will only work if the object exists and was not modified
const getResult = await store.getObjectIfMatch(key, updateTag)
// getResult deeply equals { hello: 'world', foo: 'bar' }

// use this if you don't have any etag and want to get the object
// for the first time.
const [getResult1, getTag] = await store.getObject(key)

lower level API any type of objects

import createS3Store from '@kessler/s3-store'

const store = createS3Store('my-bucket', /* { client: optionally provide your own s3 client} */)
const key = 'test-object'
const body = JSON.stringify({ hello: 'world' })
const contentType = 'application/json'

// Create object
const createResult = await store.createObject(key, body, contentType)
//createResult.response === AWS sdk response

const updateResult = await store.putObjectIfMatch(key, updateBody, createResult.etag, contentType)
//updateResult.response === AWS sdk response

// Get object with etag
const getIfMatchResult = await store.getObjectIfMatch(key, updateResult.etag)
//getIfMatchResult.response === AWS sdk response
console.log(await getIfMatch.asString())