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

rpc-fs

v0.5.2

Published

fs for fs-rpc

Downloads

5

Readme

provides a subset of node fs functions to be used by fs-rpc

synchronous versions are not available

var fs = require('rpc-fs');
fs.mkdir('/dirA', function (err) { .. });

##additional functions

mkdirp(path, callback)

mkdir -p

fs.mkdirp('/not/existing/pathname', function (err) { .. });

rmrf(path, callback)

rm -rf dirA

fs.rmrf('/dirA', callback);

stats([filename1, filename2, ..], callback)

get stats for multiple files

fs.stats(['/dirA', 'file0'], function (err, statList) {
	-> statList = {
		"file0": {size: 42, mtime: 1448884388662, ino: 2342, birthtime: 1448884388665 ..},
		"dirA": {size: 42, mtime: 1448884388663, ..}
	}
});

readdirStat(path, callback)

readdir() and stat() combined

fs.readdirStat('/dirA', function (err, dirstats) {
	-> dirstats = {
		"file1": {size: 42, mtime: 1448884388662, ..},
		"dir 2": {size: 42, mtime: 1448884388663, ..}
	}
});

readFileChunked(filename, options, callback)

read chunks of a file

fs.readFileChunked('/file0', {chunk: 1, chunkSize: 42} function (err, result) {
	-> result = {
		// end of file
		"EOF": true,	
		// chunk no read
		"chunk": 1,		
		// used chunk size
		"chunkSize": 131072,	
		// base64 encoded file content
		"content": "mSBkZWZhdWx0IGVycm9yIGhhb.."		
	}
});

writeFileChunked(filename, data, options, callback)

write chunks of a file

fs.writeFileChunked('/file0', 'file content', {chunk: 1, chunks: 1}, function (err) {
	..
});

call in-order, chunks will be appended

  • filename <String>
  • data <String> | <Buffer>
  • options <Object>
  • callback <Function>

options:

{
 chunk: 1  // current chunk number, default: 1
 chunks: 2 // total number of chunks, default: 1
}

How to calculate the total number of chunks?

data = Buffer.from('this is a tést');
chunkSize = 4096;
chunks = Math.ceil(data.byteLength / chunkSize);

Keep in mind that the actual byte length of a string is not the same as String.prototype.length since that returns the number of characters in a string:

> s = 'this is a tést'
'this is a tést'
> s.length
14
> b = Buffer.from(s)
<Buffer 74 68 69 73 20 69 73 20 61 20 74 c3 a9 73 74>
> b.byteLength
15
> Buffer.byteLength(s)
15

install

requires node >= 5.0 (uses generator/yield)

$ npm install

Test

$ npm test

or watch:

$ ./node_modules/.bin/mocha -w

License

WTFPL