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

joojle-db-files

v0.0.5

Published

A simple database that allows low-level data manipulation. It stores data as files, rather than in a format. More In The README

Downloads

17

Readme

Joojle DB Files

joojle DB Files is super-simple psuedo database that allows you to store simple structures. It is not meant to store data like a traditional database and you will probably need one to complement this

Motivations

I wanted to create a simple file-storage solution that would allow users to upload files. I was using Next-js with vanilla js, and mongoose to access mongo-db (my primary database). However, i found a lack of existing solutions to connect to Mongo's Grid-Fs in a simple and elegent manner. Whats more, is that i did not want to store all the users' files onto my own server (which ran the next instance). So i decided to re-invent the wheel and produce Joojle-db-fs.

Use Cases

This has been made entirely as a toy-project and is not a fully featured database. It lacks some important features, but I plan to add them in due corse of time. In the meanwhile, I continue to work on my main project, that uses this. For most traditional cases, use other databases, but if you find yourself in a situation like mine, feel free to uses it. Most importantly, please make sure to test this your project thoroughly.

Usage

Install the entire package

$npm i --save joojle-db-files

This installs the package entire server AND driver

To run the server execute the start.sh or start.cmd command based upon your OS

One the server starts, use import an use the driver into your project like so

const { createDb } = require("joojle-db-files")
const db = createDb()       // or with createDb({ auth:{...data from createUser Function}, connection:{...self_explanitory}  })

Then use this db to create machines, drive, and datafiles

//index.js

/** Create Drive */
db.setDefaultMachine("m2") // not necessary
db.setDefaultDrive("d2")   // not necessary
// if degault machine is not set, you need to pass it in as {machine: "..."}
const res1 = await db.createMachine()
// same thing for drive + machine also needed
const res2 = await db.createDrive()
// same thing here too!
const res3 = await db.createData({ data: "Hello World Def" })

Return Values

The functions all return a Promise, resolving to an object with a "success" value, either a true or a false. If false then the function failed

In case of the readDrive and readData functions, a data key is also present and contains the requested data

if setDefaultMachine and drive have been called, no need to provide them is needed in any of the functions. If only these two or one of them are needed, the object can be completely ommited

Function Name | Parameters |Description |Return Values --------------|---------------------------------------------|-------------------------------------------------------------------------------------------|-------------------- createMachine | {machine: "..."} | Creates A Machine With The Given Name Or The Default Name | { success: boolean } createDrive | {machine: "...", drive: "..."} | Creates A Drive With Given Or Default Name In The Given Machine Or Default Machine | { success: boolean } readDrive | {machine: "...", drive: "..."} | Reads A Drive With Given Or Default Name In The Given Machine Or Default Machine | { success: boolean, data: [string] } createData | {machine: "...", drive: "...", data: ""} | Creates A Data File | { success: boolean, id: string } readData | {machine: "...", drive: "...", id: ""} | Reads A Data File In Drive With Given ID | { success: boolean, data: string }