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

gun-file

v1.0.123

Published

Streaming JSON file driver for Gun.

Downloads

48

Readme

gun-file

A streaming file extension for Gun.

Controlling Options

	var gun = new Gun( { 'file-name' : 'yourData.json',  // default is 'data.json6'
                             'file-mode' : 0666, // default is 0666
                             'file-pretty' : true, // default, if false, will write ugly/compressed json
                             'file-delay' : 100,  // default. control flush interval/delay default.
                           } );

Important

To avoid conflict with Gun's builtin file driver, you will have to use require('gun/gun') plus any other modules you want to use. The option file:null should work in gun to disable the builtin driver, but at this point does not.

var Gun = require( "gun/gun" );
require( 'gun-file' );

Changelog

  • 1.0.123 - update to gun latest API ( deleted internal value)
  • 1.0.121 - generate 'in' on ctx instead of gun. (Issue #2)
  • 1.0.120 - test file path dyanamically to use common gun instead of potential private path...
  • 1.0.119 - update to gun 0.9
  • 1.0.118 - 'in' events require posting the gun instance they are on in the message now. Change default filename to data.json6.
  • 1.0.117 - remove alpha warning message.
  • 1.0.116 - add shared cache between instances using the same filename
  • 1.0.115 - fix a couple more short timeout cross read/writes.
  • 1.0.114 - handle short timeouts better; flushes during flushes would lose the event to flush.
  • 1.0.113 - Handle multiple connections with same file better; prevent writing while another is reading.
  • 1.0.112 - add acks on puts; add method to attach gun-file to a gun datbase should it fail to load correct gun base.
  • 1.0.111 - fix getting file-pretty option.
  • 1.0.11 - update gun revision in package.json; added .npmignore
  • 1.0.1 - update to JSON6 library rename of 'add' to 'write'
  • 1.0.0 - Initial release

Benchmark Results

__ Small Nodes: 10 Properties Each __
Write 10000 nodes: : 2164ms; 2.164s; 0.216 ms/node; errors: 0.
Read 10000 nodes: : 3005ms; 3.005s; 0.300 ms/node; errors: 0.
Update 10000 nodes: : 2404ms; 2.404s; 0.240 ms/node; errors: 0.
Update single field on 10000 nodes: : 2593ms; 2.593s; 0.259 ms/node; errors: 0.
__ Medium Nodes: 1000 Properties Each __
Write 100 nodes: : 2302ms; 2.302s; 22.792 ms/node; errors: 0.
Read 100 nodes: : 2411ms; 2.411s; 23.871 ms/node; errors: 0.
Update 100 nodes: : 1636ms; 1.636s; 16.198 ms/node; errors: 0.
Update single field on 100 nodes: : 1667ms; 1.667s; 16.505 ms/node; errors: 0.
__ Large Nodes: 10000 Properties Each __
Write 10 nodes: : 2838ms; 2.838s; 258.000 ms/node; errors: 0.
Read 10 nodes: : 3444ms; 3.444s; 313.091 ms/node; errors: 0.
Update 10 nodes: : 2097ms; 2.097s; 190.636 ms/node; errors: 0.
Update single field on 10 nodes: : 2177ms; 2.177s; 197.909 ms/node; errors: 0.