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

blaauw-indexeddb-file-storage

v1.1.0

Published

A project for file caching files using IndexedDB.

Readme

blaauw-indexeddb-file-storage

Overview

The blaauw-indexeddb-file-storage library provides a simple way to manage files and their metadata in an IndexedDB database. It allows you to store files, queue uploads, and manage downloads, making it suitable for offline caching and background synchronization.

Project Structure

blaauw-indexeddb-file-storage 
├── src 
│ ├── lib 
│ │ ├── FileManager.ts 
│ │ └── storage 
│ │ └── indexeddb-storage.ts 
│ └── types 
│ │ └── index.ts 
├── src 
│ ├── components 
│ │ ├── FileManagerTest.vue 
│ │ ├── UploadManagerTest.vue 
│ │ └── DownloadManagerTest.vue 
├── package.json 
├── tsconfig.json 
└── README.md

Features

  • File Storage: Store and retrieve files in IndexedDB.
  • Upload Management: Queue files for upload and track their status.
  • Download Management: Manage downloaded files and their metadata.
  • Metadata Storage: Store metadata for both uploads and downloads.
  • Vue.js Components: Includes Vue.js components for testing and demonstration.

Installation

To get started with the project, follow these steps:

  1. Clone the repository:

    git clone https://github.com/yourusername/blaauw-indexeddb-file-storage.git
  2. Navigate to the project directory:

    cd blaauw-indexeddb-file-storage
  3. Install the dependencies:

    npm install

Usage

Initialization

Import the initialize function and use it to create a FileManager instance:

import { initialize } from 'blaauw-indexeddb-file-storage';

const fileManager = await initialize('myStorage');

File Operations

// Add a file
await fileManager.addFile('my-file.txt', fileBlob, 'text/plain');

// Get a file
const fileData = await fileManager.getFile('my-file.txt');

// Remove a file
await fileManager.removeFile('my-file.txt');

Upload Management

import { UploadStatus } from 'blaauw-indexeddb-file-storage';

// Queue a file for upload
await fileManager.queueUpload('my-file.txt', fileBlob, 'text/plain', 'https://example.com/upload');

// Get all upload metadata
const uploads = await fileManager.getAllUploadMetadata();

// Get uploads by status
const pendingUploads = await fileManager.getUploadMetadataByUploadStatus(UploadStatus.PENDING);

// Remove upload metadata
await fileManager.removeUploadMetadata(1);

Download Management

import { DownloadStatus } from 'blaauw-indexeddb-file-storage';

// Add download metadata
const downloadId = await fileManager.addDownloadMetadata('my-file.txt', 'https://example.com/download', 'text/plain', DownloadStatus.PENDING, Date.now());

// Get all download metadata
const downloads = await fileManager.getAllDownloadMetadata();

// Get downloads by status
const pendingDownloads = await fileManager.getDownloadMetadataByDownloadStatus(DownloadStatus.PENDING);

// Remove download metadata
await fileManager.removeDownloadMetadata(1);

TypeScript Declarations

If you encounter TypeScript errors when using this library, you may need to provide custom type declarations. This can happen if the automatic type inference is not working correctly.

To resolve this, create a *.d.ts file (e.g., types/blaauw-indexeddb-file-storage.d.ts) in your project and add the following declarations:

declare module 'blaauw-indexeddb-file-storage';
declare module 'blaauw-indexeddb-file-storage/dist/types' {
  export interface FileData {
    contentType: string;
    content: File;
  }

  export interface UploadMetadata {
    id?: number;
    fileKey: string;
    url: string;
    contentType: string;
    uploadStatus: 'pending' | 'uploading' | 'completed' | 'failed';
    retryCount: number;
  }

  export interface DownloadMetadata {
    id?: number;
    fileKey: string;
    url: string;
    contentType: string;
    downloadStatus: 'pending' | 'downloading' | 'completed' | 'failed';
    lastAccessed: number;
  }

  export enum DownloadStatus {
      PENDING = 'pending',
      DOWNLOADING = 'downloading',
      COMPLETED = 'completed',
      FAILED = 'failed',
  }
}

Make sure your tsconfig.json includes this *.d.ts file. For example:

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "*": ["src/*", "types/*"]
    }
  },
  "include": ["src/**/*", "types/**/*"]
}

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue for any enhancements or bug fixes.

License

This project is licensed under the MIT License. See the LICENSE file for more details.