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

@nojaja/filecontainer

v1.0.6

Published

File container and management utility class for JavaScript applications

Readme

Gitpod Ready-to-Code License

FileContainer

JavaScript/TypeScript向けのファイル管理ユーティリティライブラリです。

@nojaja/filecontainer は、ファイルの追加・削除・コピー・リネーム、エディタ連携、Gistデータ生成、Service Workerキャッシュ公開などの機能を提供します。

主要コンポーネント

  • FileContainer
    • 複数ファイルをまとめて管理するコンテナ
    • ファイルツリーの取得、ファイル操作、イベント通知、Gist連携などを提供
  • FileData
    • 単一ファイルのメタデータとコンテンツを管理
    • MIMEタイプ・言語の自動判定、JSONシリアライズ対応
  • EditorFileData
    • FileData を拡張し、Monaco Editorモデル同期をサポート
  • PublishFileContainer
    • FileContainer を拡張し、公開パス配下のファイルをService Workerキャッシュへ保存

インストール

npm install @nojaja/filecontainer

使い方

import { FileContainer, FileData } from '@nojaja/filecontainer'

const container = new FileContainer()
const file = new FileData({ filename: 'example.txt', content: 'Hello FileContainer!' })

await container.putFile(file)
console.log(container.existFile('example.txt')) // true

const opened = container.openFile('example.txt')
if (opened) {
  opened.setContent('Updated content')
  await container.saveFile('example.txt')
}

console.log(container.getFileRaw('example.txt'))

主なAPI

FileContainer

  • setId(id: string): void
  • getId(): string | number
  • setProjectName(projectName: string): void
  • getProjectName(): string | null
  • getDirectories(parentPath?: string | null): PathEntry[]
  • getFiles(parentPath?: string | null, all?: boolean): PathEntry[]
  • getOpenFiles(parentPath?: string | null): string[]
  • existFile(filename: string): boolean
  • getFile(filename: string, fileCls?: any, ...constructorParam: any[]): FileData | null
  • getFileRaw(filename: string): FileDataRaw | null
  • openFile(filename: string, fileCls?: any, ...constructorParam: any[]): FileData | null
  • closeFile(filename: string): FileData | null
  • saveFile(filename: string): Promise<boolean> | false
  • putFile(file: FileData): Promise<boolean>
  • copyFile(src: string, dest: string, mode?: number): boolean
  • renameFile(filename: string, newName: string): boolean
  • removeFile(filename: string): boolean
  • clear(): void
  • init(): void
  • setPublic(bool: boolean): void
  • getPublic(): boolean | null
  • setDescription(description: string): void
  • getDescription(): string | null
  • setContainer(container: ContainerData): void
  • getContainer(): ContainerData | null
  • setContainerJson(container: string): void
  • getContainerJson(): string
  • getGistData(): object
  • getGistJsonData(): string
  • getCreatedTime(): number
  • getLastUpdatedTime(): number
  • setCreatedTime(createdTime: number): void
  • setLastUpdatedTime(lastUpdatedTime: number): void

FileData

  • constructor(file?: Partial<FileDataRaw> | FileData)
  • setLanguage(language: string): void
  • getLanguage(): string
  • setFileType(fileType: string): void
  • getFileType(): string
  • setType(type: string): void
  • getType(): string
  • getSize(): number
  • setContent(content: string): string
  • getContent(): string
  • setFilename(filename: string): void
  • getFilename(): string
  • setDescription(description: string): void
  • getDescription(): string
  • getFileData(): FileDataRaw
  • getFileDataJson(): string
  • remove(): void

開発とビルド

スクリプト

  • npm run build - Webpackでバンドルを生成
  • npm run test - Webpackビルド後にJestでカバレッジ付きテスト実行
  • npm run test:ci - CI向けにカバレッジ収集付きテスト実行
  • npm run lint - src/に対してESLint実行
  • npm run type-check - TypeScript型チェック
  • npm run docs - TypeDocでMarkdown形式のAPIドキュメント生成
  • npm run dev / npm start - Webpack --watch で開発ビルド

ビルド構成

  • webpack.config.jssrc/index.ts をエントリとし、dist/bundle.js を出力
  • Babelは @babel/preset-env@babel/preset-typescript を使用
  • Jestは babel-jestsrc/**/*.ts をトランスパイル

ドキュメント

  • TypeDoc設定は typedoc.json
  • 出力先は docs/typedoc-md

テスト

  • 単体テスト: tests/unit/**/*.spec.js
  • カバレッジテスト: tests/coverage/**/*.spec.js
  • カバレッジ判定は jest.coverage.config.js で50%以上に設定

依存関係

  • @babel/core, @babel/preset-env, @babel/preset-typescript
  • babel-jest, babel-loader
  • cross-env, eslint, typescript, webpack, webpack-cli
  • jest, ts-jest, typedoc, typedoc-plugin-markdown

ライセンス

MIT