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 🙏

© 2026 – Pkg Stats / Ryan Hefner

diskette

v1.2.2

Published

Stream buffers and strings efficiently in-memory

Readme

Diskette

Build Status Dependency Status

Diskette is a virtual file format that allows for efficient in-memory reads and writes. Files can be constructed from any buffer or string and they are fully streamable. As a consequence, any buffer or string can be streamed as if it was a regular file.

Projects making use of it:

Your project here?

let diskette = require('diskette')

let file = new diskette.File({
  blockLength: 20
})

file.append('yo bruh\n')
file.append('i heard you like files\n')
file.write(4, 'dude')

let rest = new File('so i made files in memory that can be piped to just about anything\n')
let restStream = new diskette.ReadableFileStream(rest)

let out = new diskette.WritableFileStream(file)

restStream.pipe(out)

restStream.on('end', () => {
  file.append('hope you like it')
})

let s = new diskette.ReadableFileStream(file)
s.pipe(process.stdout)

Result:

yo dude 
i heard you like files
so i made files in memory that can be piped to just about anything
hope you like it

API

File

new File([content][, options])

Create a new file which has its contents stored in-memory, optionally filled with content, and with one of the following options:

  • blockLength: the size of one block

Note: content can be omitted.

file.size

The total length of the file, in bytes.

file.write(position, bufferOrString[, bufferStart][, bufferEnd])

Writes the content of buffer between the given indices to the given position. If no indices are provided, the enitre content of the buffer is written to file.

file.append(bufferOrString[, bufferStart][, bufferEnd])

Just like file.write, except that it appends data to the end of the file.

file.read(position, buffer, bufferStart, bufferEnd)

Reads content of file starting at the given position to the given buffer, optionally limited by two indices denoting the start and the end position of the buffer.

file.buffer([freeSpacePreceding = 0][, freeSpaceFollowing = 0])

Get a buffer that holds the content of file. Optionally make the buffer contain freeSpacePreceding and freeSpaceFollowing of free space.

file.toString([enc])

Convert the file to a string representation, using the specified encoding. Defaults to utf8.

file.allocateBlock()

Allocates a new block for writing content. This method is automatically called by the class, and generally should not be used.

file.totalLength()

Returns the total space the file occupies in-memory, including unused free space.

file.clear()

Clears all content of file by destroying the blocks, making it seem like an empty file was just created.

ReadableFileStream

new ReadableFileStream(file[, options])

Constructs a new readable stream of which data of file can be read. The options are:

  • chunkSize: how much data to stream in one cycle. Use -1 to make the chunk as large as possible (possibly the enitre file content). Defaults to -1.
  • startPosition: an offset in the file to start reading from. Defaults to 0.

WritableFileStream

new WritableFileStream(file[, options])

Constructs a new writable stream that writes data to file starting at the given position.

Similar projects