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

@forlagshuset/simple-fs

v0.5.2

Published

File system in indexeddb

Downloads

358

Readme

SimpleFS

view on npm npm module downloads Dependency Status Known Vulnerabilities Build Status License: MIT

A minimal, extensible and promise based filesystem layer for modern browsers.

Live Demo

Supported storage backend

Simple-fs provides two storage backend. It's possible to write your own stoage backend using Storage API

  • IndexedDB (default)
import { IndexedDbStorage } from '@forlagshuset/simple-fs'
  • Memory (experimental and used for testing)
import { MemoryStorage } from '@forlagshuset/simple-fs'

Installation

npm:

npm install --save @forlagshuset/simple-fs

Usage

browser (umd):

<script src='https://unpkg.com/@forlagshuset/simple-fs@latest/dist/SimpleFS.js' async></script>
<script>
  // by default SimpleFS uses IndexedDB
  const fs = new SimpleFS.FileSystem()
  // do stuff

  await fs.mkdir('/myproject')

  // create a file under root folder
  const content = new Blob(['This is my cool project'], {type: 'plain/text'})
  await fs.writeFile('/myproject/test.txt', content)

  // get content as blob
  let blob = await fs.readFile('/myproject/test.txt')

</script>

browser (modules)

import SimpleFS from '@forlagshuset/simple-fs'
// OR es6 modules from unpkg
import SimpleFS from "//unpkg.com/@forlagshuset/simple-fs?module"

const fs = new SimpleFS.FileSystem()

// first create root folder
await fs.mkdir('/myproject')

// create a file under root folder
const content = new Blob(['This is my cool project'], {type: 'plain/text'})
await fs.writeFile('/myproject/test.txt', content)

// get content as blob
let blob = await fs.readFile('/myproject/test.txt')

API

FileSystem

constructor({storage: storageObj = new IndexedDbStorage('my-storage-name')})
mkdir(path: string)
mkdirParents(path: string) // wraps mkdir -p
rmdir(path: string)
rmdirRecursive(path: string) // removes dirs recursively
readFile(path: string, options={}) // returns Blob
writeFile(path: string, data: Blob, options={}) // data should be Blob type
outputFile(path: string, data: Blob, options={}) // Wraps writeFile and recursively creates path if not exists
bulkOutputFiles([{path: string, blob: Blob, options:{}]) // Output files in one transaction, speeds up in chrome
unlink(path: string)
exists(path: string)
stats(path: string)

Browser support

  • Chrome
  • IE Edge
  • Firefox
  • Safari