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

web3-file

v0.2.0

Published

The Web File implementation for Web3

Downloads

6

Readme

web3-file

Build dependencies Status JavaScript Style Guide Downloads Minzipped size

The Web File implementation for Web3.

Table of Contents

Motivation

The Web File implementation and standard are still on their beginning.

The current implementation has a non standard File.webkitRelativePath read-only property that we cannot use outside the webkitdirectory context. As a result, we cannot set a File path programatically in the Browser, nor in Node.js @web-std/file.

Web3File bridges this gap by adding a path property and other extras, while being a close implementation of Web File. This allows files to be transformed into their UnixFs representation and back into the original structure, and leverage the IPFS Content Routing primitives.

Install

# install it as a dependency
$ npm i web3-file

API

To create your Web3File with an async iterable content, you can simply create an instance of Web3File. Otherwise, you can leverage one of the static functions provided to create a Web3File from another data type.

Please note that the same options of the constructor can be provided in the static functions.

class Web3File

| Name | Type | Description | |------|------|-------------| | content | AsyncIterable<Uint8Array> | File content to be read | | filename | string | filename | | [options] | object | Web3File options | | [options.path] | string | File Path | | [options.lastModified] | number | Last modified timestamp |

import { Web3File } from 'web3-file'

const file = new Web3File(
  fs.createReadStream('path/to/file.zip'),
  'file.zip',
  {
    path: 'path/to/file.zip',
    lastModified: Date.now()
  }
)

Web3File#name

  • Returns string

Get file name.

Web3File#path

  • Returns string

Get file path.

Web3File#lastModified

  • Returns number

Get file last modified timestamp.

Web3File#content

  • Returns AsyncIterable<Uint8Array>

Get file content readable source.

Web3File#iterator()

  • Returns AsyncIterable<Uint8Array>

Get file content readable source iterator.

Web3File#blob()

  • Returns Promise<Blob>

Get file content as a Blob.

Web3File#text()

  • Returns Promise<String>

Get file content as Text.

Web3File.fromBytes

Takes Uint8Array bytes to create a Web3File.

import Web3File from 'web3-file'

const file = Web3File.fromBytes(new Uint8Array([2, 44, 1]), 'file.zip')

Web3File.fromText

Takes a string content to create a Web3File.

import { Web3File } from 'web3-file'

const file = Web3File.fromText('web3file', 'file.txt')

Web3File.fromReadableStream

Takes a Readable Stream content to create a Web3File.

import { Web3File } from 'web3-file'

const response = await fetch('https://example.org/image.png')
const file = Web3File.fromReadableStream(response.body, 'image.png')

Web3File.fromBlob

Takes a Blob content to create a Web3File.

import { Web3File } from 'web3-file'

const response = await fetch('https://example.org/image.png')
const blob = await response.blob()
const file = Web3File.fromBlob(blob, 'image.png')

Web3File.fromFile

Takes a File content to create a Web3File.

import { Web3File } from 'web3-file'

const image = new File([bytes], 'image.png')
const file = Web3File.fromFile(webFile)