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

@fetsorn/csvs-js

v0.17.0

Published

csvs: comma-separated value store, js bindings

Downloads

492

Readme

#+TITLE: csvs-js #+OPTIONS: toc:nil

Create, read, update and delete records in a csvs database, run powerful search queries.

  • Setup #+begin_src sh

install

npm i @fetsorn/csvs-js

test js functions

yarn test

test wasm functions in the browser with index.html

npx http-server

publish

yarn build npm publish #+end_src

  • Getting started #+begin_src js // functions exported by csvs-js require a callback // that describes how to fetch and write files from a csvs database

function fetchDataMetadir(path) { // fetch file from path }

function writeDataMetadir(path, content) { // write content to file at path }

const callback = { fetch: fetchDataMetadir, write: writeDataMetadir }

// get array of results from query var searchParams = new URLSearchParams() searchParams.set('val1', 'foo') const query1 = await queryMetadir(searchParams, callback, true) console.log(query1) // [{"val1": "foo", // "val2": "bar", // "UUID": "b29b9ee3ad01efde7d8694cea4a37844c677ad807b61fa90c44409a21710035c"}]

// if object has no uuid // editEntry creates a new record in the database // and returns it let entryBaz = {"val1": "foo", "val2": "baz"} let entryNew1 = await editEntry(entryBaz, callback) console.log(entryNew1) // {"val1": "foo", // "val2": "baz", // "UUID": "33d6e141e92852d5be1930458c1713c2bed09f42d545bf95c0f6d6e271b4077a"}

const query2 = await queryMetadir(searchParams, callback, true) console.log(query2) // [{"val1": "foo", // "val2": "bar", // "UUID": "b29b9ee3ad01efde7d8694cea4a37844c677ad807b61fa90c44409a21710035c"}, // {"val1": "foo", // "val2": "baz", // "UUID": "33d6e141e92852d5be1930458c1713c2bed09f42d545bf95c0f6d6e271b4077a"}]

// if object has a uuid // editEntry updates the record with matching uuid // and returns it let entryBarbaz = {"val1": "foo", "val2": "barbaz", "UUID": "33d6e141e92852d5be1930458c1713c2bed09f42d545bf95c0f6d6e271b4077a"} let entryNew2 = await editEntry(entryBarbaz, callback) console.log(entryNew) // {"val1": "foo", // "val2": "barbaz", // "UUID": "33d6e141e92852d5be1930458c1713c2bed09f42d545bf95c0f6d6e271b4077a"}

const query3 = await queryMetadir(searchParams, callback, true) console.log(query3) // [{"val1": "foo", // "val2": "bar", // "UUID": "b29b9ee3ad01efde7d8694cea4a37844c677ad807b61fa90c44409a21710035c"}, // {"val1": "foo", // "val2": "barbaz", // "UUID": "33d6e141e92852d5be1930458c1713c2bed09f42d545bf95c0f6d6e271b4077a"}]

// deleteEntry deletes a record with matching uuid let uuid = "b29b9ee3ad01efde7d8694cea4a37844c677ad807b61fa90c44409a21710035c" await deleteEntry(uuid, callback)

const query4 = await queryMetadir(searchParams, callback, true) console.log(query4) // [{"val1": "foo", // "val2": "barbaz", // "UUID": "33d6e141e92852d5be1930458c1713c2bed09f42d545bf95c0f6d6e271b4077a"}] #+end_src

  • More csvs projects [[https://github.com/fetsorn/csvs-spec][csvs-spec]] - format description

[[https://github.com/fetsorn/qualia][qualia]] - Web UI and desktop app

[[https://github.com/fetsorn/csvs-sh][csvs-sh]] - command-line interface

[[https://github.com/fetsorn/wasm-grep][wasm-grep]] - ripgrep compiled to WASM