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

fssf

v1.1.0

Published

Promise based wrapper for node:fs

Downloads

30

Readme

fssf

provides a simple api for common file based operations

NPM Version License: ISC Node.js Version Build

Promise based wrapper for node:fs

handles .csv files

handles .json files

no external dependencies

contains opinionated conveniences

Installation

npm install fssf

Usage

// commonJS
const { ff } = require('fssf');
// es6 module
import { ff } from 'fssf'
const data = { arrayList: [[1, 1], [2, 2]] };
// JSON
await ff.writeJson(data, __dirname, 'file.json');
const obj = await ff.readJson(__dirname, 'file.json');

// CSV
await ff.writeCsv(obj.arrayList, ['header1', 'header2'], __dirname, 'file.csv');
const doubleArray = await ff.readCsv(__dirname, 'file.csv');

const objList = [
  {
    header1: 'value1',
    header2: 'value2',
  },
  {
    header2: 'value4',
  }
]

await ff.objToCsv(objList, __dirname, 'file.tsv', '\t');

// GENERAL
const stringValue = 'class is called ff, but library is called fssf';
await ff.write(stringValue, __dirname, 'file.txt');

API

path return formatted path as string

touch create empty file at path

mv moves all files and directories from one dir to another and deletes src directory

rename renames a single file

rmrf deletes dir with subdirs and files

cp copies dir contents recursively to another dir

read gets file contents as string

write creates and saves file at expected location

readdir recursively read directory and return array of names

mkdir creates directory at given path

append adds data to existing file

stat returns stat object in promise

readJson returns Object from file containing json

writeJson writes json to a file from an object

readCsv returns double array from csv file

writeCsv takes double array and writes to csv file

appendCsv adds lines to existing csv file

csvToObj returns Array of Objects representing csv file data

objToCsv takes object and writes to csv file