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

fsos

v1.1.6

Published

A file system object storage.

Downloads

473

Readme

                              ┌──────────┒
                              │   fsos   ┃
                              ┕━━━━┯━━━━━┛
                                   │
                    ╭──────────────┴───────────────╮
                    │ A file system object storage │
                    ╰──────────────────────────────╯

File system IO can be hard to get right. This library offers a simpler interface to common operations expected from an object storage. It stays as close to the file system as humanly possible.

var fsos = require('fsos')
var user = { nick: 'jade', firstName: 'Jackie', lastName: 'Dent'}
fsos.set('user/' + user.nick, JSON.stringify(user)).then(function() {
  return fsos.get('user/' + user.nick)
}).then(function(value) {
  console.log(value)
})

If an object is set successfully, all subsequent gets will return the value that was set until the object is reset.

If an object is set non-successfully, all subsequent gets will return the value it had prior, if any, until the object is reset.

It should stay consistent even if the application crashes or if multiple processes write to the same files. If the system crashes, it is likely to stay consistent, but that depends on the file system.

API

set(key, value) → Promise

Sets the value at that key. It is stored directly on a file (treating the key as a path, automatically creating folders as needed). The value can be a Buffer, a String, or a JSON-serializable object. Folders (eg. foo if something was set to foo/bar) cannot contain data.

get(key) → Promise

Reads the value at that key. Yields an error if the key does not exist.

delete(key) → Promise

Ensures that a subsequent get yields an error.

Notes

exists (to get a boolean describing whether there is data at a key) is left out. Indeed, that information does not guarantee that there will be data at that key for your next operation, as other processes may have modified it.