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

dd-file-query

v0.1.0

Published

Directory, file operation utility by glob base.

Readme

dd-file-query

globベースのディレクトリ、ファイル操作ユーティリティーです。

*This document currently exists only in Japanese.

※このモジュールは現在試験公開中です。商用での利用には注意が必要です。

インストール

$ npm install dd-file-query

これは何?

ファイル操作系のモジュールを寄せ集めて、ラッピングしたものです。
ファイル操作の際の検索や実際の処理を楽にコーディングできるよう省略できるよう、個人利用目的で作成したものです。
パフォーマンスには気を配りながら作成してますが、内部的に情報を一部オンメモリキャッシュ(stats等)する事と、
各外部モジュールへの関数呼び出しのオーバーヘッドがあるので、超ハイパフォーマンスを求める局面では不向きかもしれません。
小〜中規模(どの程度だ?)なプロダクトでファイルシステム操作を楽チンにしたい時に利用します。
※インターフェースは完全僕の好みなので、向かない方もいると思います。

どんなモジュールを利用している?

現時点、以下のモジュールを利用しています。(これらは fq、およびその派生クラスインスタンスの全てで .util[モジュール名]で参照可能です)
下記の全ての素晴らしいモジュールの製作者に感謝します。

何ができる?

globでのファイル検索、および以下のような事ができます。

  • ファイルの存在確認
  • ファイル情報の取得(種別、エンコーディング、サイズ、MIMEタイプ、a、b、c、birthtime、、、etc)
  • セーフパス生成
  • ファイル読み込み(buffer、テキスト(文字コード変換付き)、JSON、Yaml)
  • ファイル書き込み(buffer、テキスト(文字コード変換付き)、JSON、Yaml)
  • 削除
  • 複製
  • コピー
  • リネーム
  • 移動
  • zip圧縮
  • zip展開
  • ディレクトリツリー情報の取得(JSON or テキスト)
  • ファイル、ディレクトリのwatch

使い方

このモジュールは2通りの利用方法があります。

Entries、及びEntryインスタンスを取得してからいろんな事をやる場合

const fq = require('dd-file-query');

(async () => {
  const entries = await fq.load('path/to/**/*.txt');
  await entries.delAll();
  
  const entry = await fq.single('path/to/hoge.txt');
  const text = await entry.readText('Shift-JIS');
  await entry.writeText(text + '\nworked!!!!', 'Shift-JIS');
})();

ファクトリーから直接操作のみを行う場合

const fq = require('dd-file-query');

(async () => {
  await fq.delAll('path/to/**/*.txt');
})();

Factory & Class API

このモジュールで作らなかった機能

  • rsync → cliに依存する事と、rsyncは今のところこのモジュールのインターフェースに合わせるメリットが見つからなかったため
  • Stream系 → 現状不要と判断。将来的に必要を感じたら作る

TEST

npm test

License

Licensed under MIT

Copyright (c) 2018 dadajam4