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

file-fun

v0.0.4

Published

Wrap functions to work with files

Downloads

4

Readme

file-fun

Wrap functions to work with files

Usage

sync_async(f)

Take a syncronous function and generate an asynchronous function, which receives a callback as the last argument

result = f(input)
g = sync_async(f)
g(input, function(err, result) { })

one-to-one functions

Generate functions which work with files from an asynchronous function which receives and returns (through a callback) a single value

stringToString_fileToFile

// stringToString_fileToFile(f, oldInputIndex = 0, newOutputFilePathIndex = 1)

f(input, function(err, result) { })
g = stringToString_fileToFile(f)
g(inputFilePath, outputFilePath, function(err, outputFilePath) { })

fileToFile_globsToDir

globsToDirWithWatch works in the same way as globsToDir, but it then watches the patterns to (1) rerun the function on files which were added or have changed and (2) delete files when the original file is deleted

// fileToFile_globsToDir(f, extension, oldInputIndex = 0, oldOutputIndex = 1, newGlobOptionsIndex = 1)
// fileToFile_globsToDirWithWatch(f, extension, oldInputIndex = 0, oldOutputIndex = 1, newGlobOptionsIndex = 1)

f(inputFilePath, outputFilePath, function(err, outputFilePath) { })
g = fileToFile_globsToDir(f)
g( [patterns] , globOptions, outputDir, function(err, outputFilePaths) { })

stringToString_globsToDir

// stringToString_globsToDir(f, extension, inputIndex = 0)
// stringToString_globsToDirWithWatch(f, extension, inputIndex = 0)

f(input, function(err, result) { })
g = stringToString_globsToDir(f)
g( [patterns] , globOptions, outputDir, function(err, outputFilePaths) { })

sync_fileToFile

// sync_fileToFile(f, inputIndex = 0)

sync_globsToDir

// sync_globsToDir(f, inputIndex = 0)

sync_globsToDirWithWatch

// sync_globsToDirWithWatch(f, inputIndex = 0)

transform streams

Generate functions from a transform stream

transformStream_stringToString

// transformStream_stringToString(transformStreamConstructor)

g = transformStream_stringToString(transformStreamConstructor)
g(input, function(err, result) { })

transformStream_fileToFile

// transformStream_fileToFile(transformStreamConstructor)

g = transformStream_fileToFile(transformStreamConstructor)
g(inputFilePath, outputFilePath, function(err, outputFilePath) { })

transformStream_globsToDir

// transformStream_globsToDir(transformStreamConstructor)

g = transformStream_globsToDir(transformStreamConstructor)
g( [patterns] , globOptions, outputDir, function(err, outputFilePaths) { })

many-to-one functions

Generate functions which work with files from an asynchronous function which receives a list of values and and returns (through a callback) a single value

stringsToString_filesToFile

// stringsToString_filesToFile(f, oldInputIndex = 0, newOutputFilePathIndex = 1)

f( [input] , function(err, result) { })
g = stringsToString_filesToFile(f)
g( [inputFilePaths] , outputFilePath, function(err, outputFilePath) { })

filesToFile_globsToFile

// filesToFile_globsToFile(f, oldInputIndex = 0, oldOutputIndex = 1, newGlobOptionsIndex = 1)

f( [inputFilePaths] , outputFilePath, function(err, outputFilePath) { })
g = filesToFile_globsToFile(f)
g( [patterns], globOptions, outputFilePath, function(err, outputFilePath){ })

stringsToString_globsToFile

// stringsToString_globsToFile(f, inputIndex = 0)

f( [input] , function(err, result) { })
g = stringsToString_globsToFile(f)
g( [patterns], globOptions, outputFilePath, function(err, outputFilePath){ })

sync_filesToFile

// sync_filesToFile(f, inputIndex = 0)

sync_globsToFile

// sync_globsToFile(f, inputIndex = 0)