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

als-fo

v0.5.4

Published

Collection of usefull operations with files.

Downloads

4

Readme

als-fo (file operations)

New in V0.5

  • Added delay to fo.watch to prevent runing fn twice on windows
  • Fixed fo.delete
  • Added fo.changeExt

New in V0.5.1

  • Added fo.isFile

New in V0.5.3

  • Added fo.buildFile
  • Fixed filtering by extension in getFilesList

Collection of usefull operations with files.

let fo = require('als-fo)

// If obj can be stringified, returned stringified. 
   fo.isJson(obj)
// Checking if path array and return joined path or return path
   fo.path(path)

// Checking if obj is json and stringify it. Writing the file to path. Path checked by fo.path.
   fo.writeFile(path,obj,encoding = 'utf-8')

// Readigng file, if json return object. Path checked by fo.path.
   fo.readFile(path,encoding = 'utf-8')

// If path exists, return true. Else return false. Path checked by fo.path.
   fo.isExist(path)

// Check if module exists, deleting cache and return required module
   fo.require(path) // if not exists return empty object 

// Checking if folder for path are existen. Creating file with fo.path and fo.isJson
// If where givemt console.log(result)
   fo.createPath(path,content,where='')

// If folder not exists, create it. 
   fo.makeDir(dir)

// Removing dirToRemove, adding host and replace \ to /
   fo.urlFromPath(path,dirToRemove,host)

// Wathing given folder(dir) and runs function(fn) then change occures. fn(event,filename)
   fo.watchDir(dir,fn)

// Runs recursevly and return list of files in given folder(dir) and it's subfolders with given extension (ext).
// If extension not given, return all files in folder and it's subfolders.
// ignore array will include path of files to ignore
   fo.getFilesList(dir,ext,ignore=[],filelist = [])

// if path has this extension return true, else return extension of given path
   fo.ext(path,ext)

// Runs fo.getFilesList and get all files. Then add it to mainList (has to be array)
   fo.addToList(path,mainList)

// Just return time in hh:mm:ss
   fo.now()

// return path creation date
   fo.fileDate(path)
   
// delete the path
   fo.delete(path)

// recursive copy files and foldre from src to dest
   fo.copy(src, dest)

// Checks if path is directory. Retrun true if directory and false if not
   fo.isDir(path)

// Checks if path is file. Retrun true if file and false if not
   fo.isFile(path)

// If cli has 'order' parameter return fn(argv). else return error to console
   fo.cli(order,fn,error)

// return capitalized string
   fo.upperFirst(string)

// Changing extension of file to newExt(without dot). path can be array (fo.path)
   fo.changeExt(path,newExt)
// if srcFilePath is js file: fo.require(srcFilePath). if content is function running function if error, content = ''.
// hooks will include functions with parameters (content,srcFilePath) and has to return content (string)
   fo.buildFile(srcFilePath,hooks=[])