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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@solarpunkltd/file-manager-lib

v0.1.3

Published

A file manager for storing and handling data on Swarm.

Downloads

268

Readme

TODO

This script uploads a directory structure to the Bee network using Mantaray as a manifest node. It lists files, saves a manifest, and allows downloading files.

Prerequisites

  1. Node.js: Ensure you have Node.js installed.
  2. Bee Node: Download and install the Bee node binary.
  3. Swarm CLI: Install the Swarm CLI tool.
  4. Postage Stamp: Use swarm-cli to buy a postage stamp for uploading files to the Bee network.

Setup Instructions

1. Run the Bee Node in Development Mode

Start the Bee node with the --dev flag to enable developer mode:

bee dev --cors-allowed-origins="*"

2. Install Dependencies

Clone this repository and navigate to the directory:

git clone https://github.com/Solar-Punk-Ltd/file-manager-lib
cd file-manager-lib

3. Buy Postage Stamp and Replace the id in index.ts

Step 1: Install swarm-cli

npm install -g @ethersphere/swarm-cli

Step 2: List Existing Stamps

Check if you have any active postage stamps:

swarm-cli stamp list

Step 3: Buy a New Stamp

If no stamps exist or you want to purchase a new one, run the following command:

swarm-cli stamp buy --amount 100000000000 --depth 20

Example Output:

Batch ID: c0598ec076f1a7222b9f074343c1009535e045cfa70e50aa34ca5c6b868a4daf

Step 4: Replace stamp id in index.ts

Replace batch id in the index.ts:

const STAMP = 'your-postage-stamp-id';

4. Run the Script

Run the script to upload the directory, generate a Mantaray manifest, list the files, and download the uploaded files:

npm run build
npm start

5. Troubleshooting

1. Manifest Not Found

  • Error: You are unable to access files using the manifest reference URL.
  • Solution: Ensure that:
    • The manifest reference is correctly copied from the console output.
    • The Bee node is running and accessible at http://localhost:1633.

2. File Not Found

  • Error: Specific files are not accessible even though the manifest reference is valid.
  • Solution: Verify that:
    • The directory structure (nested-dir) is correct and includes the expected files.
    • The files were properly uploaded and listed during the script's execution.

3. Postage Stamp Expired

  • Error: Uploads fail due to insufficient funds or expired postage stamps.
  • Solution:
    • Purchase a new postage stamp using:
      curl -s -X POST http://localhost:1635/stamps/1000000/20
    • Update the STAMP constant in the script with the new postage stamp ID.

4. Permission Denied

  • Error: Files or directories in nested-dir cannot be read.
  • Solution:
    • Ensure all files have read permissions:
      chmod -R 755 nested-dir

5. Bee Node Crashes or Becomes Unresponsive

  • Error: The Bee node stops unexpectedly during the upload or download process.
  • Solution:
    • Restart the Bee node:
      bee dev --cors-allowed-origins="*"
    • Check the Bee node logs for errors and address any issues.

6. Further Enhancements

You can enhance the script by:

  1. Adding Metadata:

    • Include additional metadata (e.g., timestamps or user-defined tags) for each file during the upload process.
  2. Dynamic Directory Selection:

    • Allow users to dynamically select the directory to upload by adding a prompt or configuration setting.
  3. Batch Processing:

    • Handle larger directories by implementing batch processing to upload files in chunks.
  4. UI Integration:

    • Create a simple frontend interface to upload, list, and download files directly from the browser.
  5. Swarm Dashboard:

    • Use a dashboard to monitor the Bee node's status, uploaded content, and active postage stamps.
  6. Postage Stamp Management:

    • Build or integrate tools to manage and renew postage stamps efficiently.

Happy Swarming! 🐝