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

@ptkhanh94npm/non-repellat-aperiam

v1.0.0

Published

> A stupidly simple key/value storage using files to persist the data

Downloads

7

Keywords

buffersmulti-packageuninstallcolorswrapbootstrap lesssettingspnpm9prettyvalidgetoptassertion.envES2017trimRightsomehttpjsjsxlesscsssortedgetterconsolewatchFilerateObjectfullwidthformcoreequalposeclassnamelistenerswatchingbyteOffsetless mixinsArray.prototype.includesdefinehookformstyled-componentseslinttrimStartmapECMAScript 2018queueObject.isUint8Arraysignals__proto__zodReactiveXwalkinges-shimspassworddefinePropertychildECMAScript 5ECMAScript 2015interruptsexpressionbabelstringflatMapwindowsoutputtaperecursiveiterationtypescriptvalueserializeoffsetgetintrinsictaskexpresstypedarrayweakmaphasOwnECMAScript 3intrinsicmkdircjkencryptionshebangyupoptimizercurriedinternalIteratorargumenttacitpromiseargvfunctionalES2019toolkiturlsymlinkscheckes8cacheirqloggerletjwtdebugcharactersclass-validatorcharacterObject.assigninputoncehelpers[[Prototype]]sharedarraybufferinferencehashString.prototype.matchAllimmutablefindupgetPrototypeOfvalidateserializerextensionpackagesmetadatacolorcallbindgroupBygraphqlString.prototype.trimequalityeveryObject.keysdomkeylintfsio-tsinstallformsstdlibshamrm -frbddeventDispatcherspringcall-boundi18nfixed-widthfindLastiteratorprotogdprReflect.getPrototypeOfawesomesaucetoobjecta11yschemenativebufferRxcompile lessjoicompilerjson-schema-validationeslint-plugingroupbannerObject.entriessafebytereduceArrayBufferhandlersextraredux-toolkitwatchdropnpmnegativestylessuperagentconstrequirearrayvarpreprocessormimelruSymbol.toStringTagtslibframeworkprotocol-buffersES2022ECMAScript 2021dirbluebirdeventEmitterwordwraperror-handlingsetPrototypeOfiefullutiljsonpathfunctionsparentsastclientassertES2023termexit-codeserializationregexopensArrayUint8ClampedArraycorsargsslotlookapimochafull-widthmobileexitzeroreactReactiveExtensionsruntimenegative zeroinspectauthenticationsetparseArray.prototype.flatvariables in csslimitpoint-freeasyncES7mimetypestraversedotenvasciispinnersunicodenodedeepcopycolourES2016mrufast-deep-copyflagnopeES6viewnested cssInt32Arrayvestutil.inspecttoSortedrm -rfpropertylastjapaneseFloat64Arraycommand-linethreehigher-orderfastshimxdg-openoptionFunction.prototype.nameArrayBuffer#sliceES2021objectcss variablecreateautoprefixerresolveObservablebabel-coreObject.valuesmixinsemojimoduleECMAScript 7_.extendJSONes-shim APImakeECMAScript 2020rmECMAScript 6envdatastructureprocessECMAScript 2019sanitizeCSSStyleDeclarationwhichtypanionRxJSlook-uptypeeslintconfigomittakeTypedArrayreadablestreamtyped arrayguidprivaterandomreact-testing-libraryremovees2018toArrayURLSearchParamsmkdirpopenerbrowserslistcssquotefantasy-landfastcopyairbnbtypeofhttpscallgradients cssfoldermiddlewareshrinkwrapdeletewarningjson-schema-validatorless.jspreserve-symlinksinstallerrequestiteratekoreanconfigRFC-6455ratelimitmatcheses2017macosxhr6to5Setes-abstractcopycolumnslockfilesettercss nestinglazycircularaccessibilitylinewrapstyleguidestylelengthflatpatchinvariantansiarktypehasargparseenvironmentpicomatchstableinternal slotescapeObject.definePropertyless csstypesUint32Arrayreact animationassignhardlinksreduxparserpathfigletWeakSetES8progressfindES2015phoneprunestatelessbindUint16ArrayreadableartsigintESnexttestingimportsymlinkWebSocketvisualmodulesstartxdgaccessorsuperstructnameemitvaluesfpimmerstringifiergradients css3filestructuredClonees2016BigInt64ArraybatchwatcherdescriptorboundECMAScript 2022codesuuidwgetmergesharedclassnamestrimkarmacliconcurrencyArray.prototype.findLastgesturestypedreusearrayschromeupxtermchromiumdeep-copycode pointsfast-deep-clonelogrfc4122bundlernodejsrgbStreamoperating-system

Readme

@ptkhanh94npm/non-repellat-aperiam

A stupidly simple key/value storage using files to persist the data

NPM Version tests codecov npm

install

npm i --save @ptkhanh94npm/non-repellat-aperiam

Usage

const flatCache = require('@ptkhanh94npm/non-repellat-aperiam');
// loads the cache, if one does not exists for the given
// Id a new one will be prepared to be created
const cache = flatCache.load('cacheId');

// sets a key on the cache
cache.setKey('key', { foo: 'var' });

// get a key from the cache
cache.getKey('key'); // { foo: 'var' }

// fetch the entire persisted object
cache.all(); // { 'key': { foo: 'var' } }

// remove a key
cache.removeKey('key'); // removes a key from the cache

// save it to disk
cache.save(); // very important, if you don't save no changes will be persisted.
// cache.save( true /* noPrune */) // can be used to prevent the removal of non visited keys

// loads the cache from a given directory, if one does
// not exists for the given Id a new one will be prepared to be created
const cache = flatCache.load('cacheId', path.resolve('./path/to/folder'));

// The following methods are useful to clear the cache
// delete a given cache
flatCache.clearCacheById('cacheId'); // removes the cacheId document if one exists.

// delete all cache
flatCache.clearAll(); // remove the cache directory

Motivation for this module

I needed a super simple and dumb in-memory cache with optional disk persistance in order to make a script that will beutify files with esformatter only execute on the files that were changed since the last run. To make that possible we need to store the fileSize and modificationTime of the files. So a simple key/value storage was needed and Bam! this module was born.

Important notes

  • If no directory is especified when the load method is called, a folder named .cache will be created inside the module directory when cache.save is called. If you're committing your node_modules to any vcs, you might want to ignore the default .cache folder, or specify a custom directory.
  • The values set on the keys of the cache should be stringify-able ones, meaning no circular references
  • All the changes to the cache state are done to memory
  • I could have used a timer or Object.observe to deliver the changes to disk, but I wanted to keep this module intentionally dumb and simple
  • Non visited keys are removed when cache.save() is called. If this is not desired, you can pass true to the save call like: cache.save( true /* noPrune */ ).

License

MIT

Changelog

changelog